> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# 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

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.
- `requestToken` header (required) — Long-lived API token sent in the `requestToken` header. See [API token authentication](/developers/api-tokens).

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Body (application/json)

This endpoint expects an AddPaymentMethodDomainRequest.

- `applePay` (AddPaymentMethodDomainRequestApplePay, optional) — Apple Pay configuration information.
- `googlePay` (AddPaymentMethodDomainRequestGooglePay, optional) — Google Pay configuration information.
- `domainName` (string, optional) — The domain. For example: `subdomain.domain.com` or `domain.com`. Must be public. Can't be `localhost`, hidden by a VPN, or protected by a password.
- `entityId` (long, optional) — The entity's ID in Payabli. If the entity is a paypoint, this is the paypoint ID. If the entity is an organization, this is the organization ID.
- `entityType` (string, optional) — The entity type. Available values: - `paypoint` - `organization` - `psp` (payment service provider)

## Response

### 200

Success

- `isSuccess` (boolean, required) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `pageidentifier` (string, required) — Auxiliary validation used internally by payment pages and components.
- `responseData` (PaymentMethodDomainApiResponse, required) — Data related to the payment method domain.
- `responseText` (string, required)

## Errors

### 400 Bad Request Error

Bad request / invalid data.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 401 Unauthorized Error

Unauthorized request.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 500 Internal Server Error

Internal server error.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 503 Service Unavailable Error

Database connection error.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

## Types

### AddPaymentMethodDomainRequestApplePay

Apple Pay configuration information.

- `isEnabled` (boolean, optional) — When `true`, the service is enabled.

### AddPaymentMethodDomainRequestGooglePay

Google Pay configuration information.

- `isEnabled` (boolean, optional) — When `true`, the service is enabled.

### PaymentMethodDomainApiResponse

Data related to the payment method domain.

- `type` (string, required, nullable) — The record type. For payment method domains, this is always `PaymentMethodDomain`.
- `applePay` (ApplePayData, required) — Details about the status of the Apple Pay service.
- `googlePay` (GooglePayData, required) — Details about the status of the Google Pay service.
- `createdAt` (datetime, required) — Timestamp of when record was created, in UTC.
- `domainName` (string, required) — The domain. For example: `subdomain.domain.com` or `domain.com`. Must be public. Can't be `localhost`, hidden by a VPN, or protected by a password.
- `entityId` (long, required) — The entity's ID in Payabli. If the entity is a paypoint, this is the paypoint ID. If the entity is an organization, this is the organization ID.
- `entityType` (string, required) — The entity type. Available values: - `paypoint` - `organization` - `psp` (payment service provider)
- `id` (string, required) — The payment method domain's ID in Payabli.
- `ownerEntityId` (long, required) — The domain's owning entity's ID in Payabli. This value might be different than the `entityId`, depending on whether the domain is cascaded and whether it's inherited.
- `ownerEntityType` (string, required) — The domain's owner's entity type. Available values: - `paypoint` - `organization` - `psp` (payment service provider)
- `cascades` (list of CascadeJobDetails, optional) — Data about the domain's cascade status.
- `updatedAt` (datetime, optional) — Timestamp of when record was last updated, in UTC.

### PayabliErrorBodyResponseData

Object with detailed error context.

- `explanation` (string, optional) — Human-readable explanation of what happened.
- `todoAction` (string, optional) — Suggested resolution.

### ApplePayData

Details about the status of the Apple Pay service.

- `data` (ApplePayStatusData, optional) — 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` (boolean, optional) — When `true`, the service is enabled.

### GooglePayData

Details about the status of the Google Pay service.

- `data` (GooglePayStatusData, optional) — 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` (boolean, optional) — When `true`, the service is enabled.

### CascadeJobDetails

Details about the cascade process.

- `createdAt` (datetime, optional) — Timestamp of when record was created, in UTC.
- `jobErrorMessage` (string, optional) — Error message for a failed cascade process.
- `jobId` (string, optional) — The cascade process ID.
- `jobStatus` (enum, optional) — The cascade process status.
  - Allowed values: `in_progress`, `completed`, `failed`
- `updatedAt` (datetime, optional) — Timestamp of when record was last updated, in UTC.

### ApplePayStatusData

Details about the Apple Pay service status.

- `errorMessage` (string, optional) — Any error message related to Apple Pay's activation status.
- `metadata` (ApplePayMetadata, optional) — This metadata appears only when the domain verification check fails. It gives more information about why the check failed.

### GooglePayStatusData

Details about the Google Pay service status.

- `errorMessage` (string, optional) — Any error message related to Google Pay's activation status.
- `metadata` (GooglePayMetadata, optional) — This metadata appears only when the domain verification check fails. It gives more information about why the check failed.

### ApplePayMetadata

This metadata appears only when the domain verification check fails. It gives more information about why the check failed.

- `isFileAvailable` (boolean, optional) — 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` (boolean, optional) — Indicates whether the domain verification file content is valid. If the file is invalid, try downloading it and hosting it again.
- `redirectDomainName` (string, optional) — The domain name if the domain verification URL returns a redirect.
- `redirectUrl` (string, optional) — 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` (integer, optional) — The status code returned by the domain verification URL.

### GooglePayMetadata

This metadata appears only when the domain verification check fails. It gives more information about why the check failed.

- `statusCode` (integer, optional) — The status code returned by the domain verification URL.
- `redirectUrl` (string, optional) — 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` (string, optional) — The domain name if the domain verification URL returns a redirect.

## Examples

**Request**

```json
{
  "applePay": {
    "isEnabled": true
  },
  "googlePay": {
    "isEnabled": true
  },
  "domainName": "checkout.example.com",
  "entityId": 109,
  "entityType": "paypoint"
}
```

**Response**

```json
{
  "isSuccess": true,
  "pageidentifier": "pageidentifier",
  "responseData": {
    "type": "PaymentMethodDomains",
    "applePay": {
      "data": null,
      "isEnabled": true
    },
    "googlePay": {
      "data": null,
      "isEnabled": true
    },
    "createdAt": "2025-04-25T15:44:17.016Z",
    "domainName": "checkout.example.com",
    "entityId": 109,
    "entityType": "paypoint",
    "id": "pmd_a4c7e39d15f24b8c8d6259f174e3d081",
    "ownerEntityId": 109,
    "ownerEntityType": "paypoint",
    "cascades": [
      {
        "createdAt": "2025-04-25T15:37:28.685Z",
        "jobErrorMessage": null,
        "jobId": "1030398",
        "jobStatus": "completed",
        "updatedAt": "2025-04-25T15:37:33.228Z"
      },
      {
        "createdAt": "2026-09-26T22:25:45.095Z",
        "jobErrorMessage": null,
        "jobId": "611502",
        "jobStatus": "completed",
        "updatedAt": "2026-09-26T22:25:46.187Z"
      },
      {
        "createdAt": "2026-09-26T19:46:40.075Z",
        "jobErrorMessage": null,
        "jobId": "611172",
        "jobStatus": "completed",
        "updatedAt": "2026-09-26T19:47:13.548Z"
      }
    ],
    "updatedAt": "2025-04-25T15:44:17.016Z"
  },
  "responseText": "Success"
}
```

**SDK Code**

```python
import requests

url = "https://api-sandbox.payabli.com/api/PaymentMethodDomain"

payload = {
    "applePay": { "isEnabled": True },
    "googlePay": { "isEnabled": True },
    "domainName": "checkout.example.com",
    "entityId": 109,
    "entityType": "paypoint"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-sandbox.payabli.com/api/PaymentMethodDomain';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"applePay":{"isEnabled":true},"googlePay":{"isEnabled":true},"domainName":"checkout.example.com","entityId":109,"entityType":"paypoint"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/PaymentMethodDomain"

	payload := strings.NewReader("{\n  \"applePay\": {\n    \"isEnabled\": true\n  },\n  \"googlePay\": {\n    \"isEnabled\": true\n  },\n  \"domainName\": \"checkout.example.com\",\n  \"entityId\": 109,\n  \"entityType\": \"paypoint\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
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["Authorization"] = 'Bearer <token>'
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
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/PaymentMethodDomain")
  .header("Authorization", "Bearer <token>")
  .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
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->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' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/PaymentMethodDomain");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"applePay\": {\n    \"isEnabled\": true\n  },\n  \"googlePay\": {\n    \"isEnabled\": true\n  },\n  \"domainName\": \"checkout.example.com\",\n  \"entityId\": 109,\n  \"entityType\": \"paypoint\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "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()
```