# Add domain POST https://api-sandbox.payabli.com/api/PaymentMethodDomain Content-Type: application/json Add a payment method domain to an organization or paypoint. Reference: https://docs.payabli.com/developers/api-reference/paymentmethoddomain/paymentmethoddomain-add ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add a payment method domain version: endpoint_paymentMethodDomain.AddPaymentMethodDomain paths: /PaymentMethodDomain: post: operationId: add-payment-method-domain summary: Add a payment method domain description: Add a payment method domain to an organization or paypoint. tags: - - subpackage_paymentMethodDomain parameters: - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_:AddPaymentMethodDomainApiResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: type: object properties: applePay: $ref: >- #/components/schemas/type_paymentMethodDomain:AddPaymentMethodDomainRequestApplePay description: Apple Pay configuration information. googlePay: $ref: >- #/components/schemas/type_paymentMethodDomain:AddPaymentMethodDomainRequestGooglePay description: Google Pay configuration information. domainName: $ref: '#/components/schemas/type_:DomainName' entityId: $ref: '#/components/schemas/type_:EntityId' entityType: $ref: '#/components/schemas/type_:EntityType' components: schemas: type_:IsEnabled: type: boolean type_paymentMethodDomain:AddPaymentMethodDomainRequestApplePay: type: object properties: isEnabled: $ref: '#/components/schemas/type_:IsEnabled' type_paymentMethodDomain:AddPaymentMethodDomainRequestGooglePay: type: object properties: isEnabled: $ref: '#/components/schemas/type_:IsEnabled' type_:DomainName: type: string type_:EntityId: type: integer format: int64 type_:EntityType: type: string type_:IsSuccess: type: boolean type_:PageIdentifier: type: string type_:ApplePayMetadata: type: object properties: isFileAvailable: type: boolean description: >- When `true`, indicates whether the domain verification file is available at the expected path. When `false`, Payabli was unable to find the file at the expected path. If the file is missing, make sure it's hosted at the correct path: `/.well-known/apple-developer-merchantid-domain-association` isFileContentValid: type: boolean description: >- Indicates whether the domain verification file content is valid. If the file is invalid, try downloading it and hosting it again. redirectDomainName: type: string description: The domain name if the domain verification URL returns a redirect. redirectUrl: type: string description: >- If the domain verification URL is redirected, this is the URL it's redirected to. For example, www.partner.com could redirect to www.partners-new-home-page.com. In this case, you should add www.partners-new-home-page.com as a domain instead of www.partner.com. statusCode: type: integer description: The status code return by the domain verification URL. type_:ApplePayStatusData: type: object properties: errorMessage: type: string description: Any error message related to Apple Pay's activation status. metadata: $ref: '#/components/schemas/type_:ApplePayMetadata' type_:ApplePayData: type: object properties: data: $ref: '#/components/schemas/type_:ApplePayStatusData' description: >- This object is only returned when the domain verification check fails. If a domain has failed validation, this object contains information about the failure. isEnabled: $ref: '#/components/schemas/type_:IsEnabled' description: When `true`, Apple Pay is enabled. type_:GooglePayMetadata: type: object properties: statusCode: type: integer description: The status code return by the domain verification URL. redirectUrl: type: string description: >- If the domain verification URL is redirected, this is the URL it's redirected to. For example, www.partner.com could redirect to www.partners-new-home-page.com. In this case, you should add www.partners-new-home-page.com as a domain instead of www.partner.com. redirectDomainName: type: string description: The domain name if the domain verification URL returns a redirect. type_:GooglePayStatusData: type: object properties: errorMessage: type: string description: Any error message related to Google Pay's activation status. metadata: $ref: '#/components/schemas/type_:GooglePayMetadata' type_:GooglePayData: type: object properties: data: $ref: '#/components/schemas/type_:GooglePayStatusData' description: >- This object is only returned when the domain verification check fails. If a domain has failed validation, this object contains information about the failure. isEnabled: $ref: '#/components/schemas/type_:IsEnabled' description: When `true`, Google Pay is enabled. type_:CreatedAt: type: string format: date-time type_:JobId: type: string type_:JobStatus: type: string type_:LastModified: type: string format: date-time type_:CascadeJobDetails: type: object properties: createdAt: $ref: '#/components/schemas/type_:CreatedAt' jobErrorMessage: type: string description: Error message for a failed cascade process. jobId: $ref: '#/components/schemas/type_:JobId' jobStatus: $ref: '#/components/schemas/type_:JobStatus' updatedAt: $ref: '#/components/schemas/type_:LastModified' type_:PaymentMethodDomainId: type: string type_:OwnerEntityId: type: integer format: int64 type_:OwnerEntityType: type: string type_:PaymentMethodDomainApiResponse: type: object properties: type: type: - string - 'null' description: >- The record type. For payment method domains, this is always `PaymentMethodDomain`. applePay: $ref: '#/components/schemas/type_:ApplePayData' googlePay: $ref: '#/components/schemas/type_:GooglePayData' cascades: type: array items: $ref: '#/components/schemas/type_:CascadeJobDetails' description: Data about the domain's cascade status. createdAt: $ref: '#/components/schemas/type_:CreatedAt' domainName: $ref: '#/components/schemas/type_:DomainName' entityId: $ref: '#/components/schemas/type_:EntityId' entityType: $ref: '#/components/schemas/type_:EntityType' id: $ref: '#/components/schemas/type_:PaymentMethodDomainId' ownerEntityId: $ref: '#/components/schemas/type_:OwnerEntityId' ownerEntityType: $ref: '#/components/schemas/type_:OwnerEntityType' updatedAt: $ref: '#/components/schemas/type_:LastModified' required: - type - applePay - googlePay - createdAt - domainName - entityId - entityType - id - ownerEntityId - ownerEntityType - updatedAt type_:AddPaymentMethodDomainApiResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' pageidentifier: $ref: '#/components/schemas/type_:PageIdentifier' responseData: $ref: '#/components/schemas/type_:PaymentMethodDomainApiResponse' responseText: type: string required: - isSuccess - pageidentifier - responseData - responseText ``` ## SDK Code Examples ```python Paypoint from payabli import payabli from payabli.payment_method_domain import ( AddPaymentMethodDomainRequestApplePay, AddPaymentMethodDomainRequestGooglePay, ) client = payabli( api_key="YOUR_API_KEY", ) client.payment_method_domain.add_payment_method_domain( domain_name="checkout.example.com", entity_id=109, entity_type="paypoint", apple_pay=AddPaymentMethodDomainRequestApplePay( is_enabled=True, ), google_pay=AddPaymentMethodDomainRequestGooglePay( is_enabled=True, ), ) ``` ```typescript Paypoint import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.paymentMethodDomain.addPaymentMethodDomain({ domainName: "checkout.example.com", entityId: 109, entityType: "paypoint", applePay: { isEnabled: true }, googlePay: { isEnabled: true } }); ``` ```go Paypoint import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.PaymentMethodDomain.AddPaymentMethodDomain( context.TODO(), &sdkgo.AddPaymentMethodDomainRequest{ DomainName: sdkgo.String( "checkout.example.com", ), EntityId: sdkgo.Int64( 109, ), EntityType: sdkgo.String( "paypoint", ), ApplePay: &sdkgo.AddPaymentMethodDomainRequestApplePay{ IsEnabled: sdkgo.Bool( true, ), }, GooglePay: &sdkgo.AddPaymentMethodDomainRequestGooglePay{ IsEnabled: sdkgo.Bool( true, ), }, }, ) ``` ```csharp Paypoint using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.PaymentMethodDomain.AddPaymentMethodDomainAsync( new AddPaymentMethodDomainRequest { DomainName = "checkout.example.com", EntityId = 109, EntityType = "paypoint", ApplePay = new AddPaymentMethodDomainRequestApplePay { IsEnabled = true }, GooglePay = new AddPaymentMethodDomainRequestGooglePay { IsEnabled = true }, } ); ``` ```ruby Paypoint require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/PaymentMethodDomain") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"applePay\": {\n \"isEnabled\": true\n },\n \"googlePay\": {\n \"isEnabled\": true\n },\n \"domainName\": \"checkout.example.com\",\n \"entityId\": 109,\n \"entityType\": \"paypoint\"\n}" response = http.request(request) puts response.read_body ``` ```java Paypoint HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/PaymentMethodDomain") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"applePay\": {\n \"isEnabled\": true\n },\n \"googlePay\": {\n \"isEnabled\": true\n },\n \"domainName\": \"checkout.example.com\",\n \"entityId\": 109,\n \"entityType\": \"paypoint\"\n}") .asString(); ``` ```php Paypoint request('POST', 'https://api-sandbox.payabli.com/api/PaymentMethodDomain', [ 'body' => '{ "applePay": { "isEnabled": true }, "googlePay": { "isEnabled": true }, "domainName": "checkout.example.com", "entityId": 109, "entityType": "paypoint" }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Paypoint import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "applePay": ["isEnabled": true], "googlePay": ["isEnabled": true], "domainName": "checkout.example.com", "entityId": 109, "entityType": "paypoint" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/PaymentMethodDomain")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```