> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://beta-docs.payabli.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server.

# 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://beta-docs.payabli.com/api-reference/paymentmethoddomain/paymentmethoddomain-add

## Authentication

- `requestToken` header (required) — API Key authentication via header

## Servers

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

## Request

### Body (application/json)

This endpoint expects an object.

- `applePay` (AddPaymentMethodDomainRequestApplePay, optional) — Apple Pay configuration information.
- `domainName` (string, optional) — The domain. For example: `subdomain.domain.com` or `domain.com`
- `entityId` (long, optional) — The entity's ID in Payabli.
- `entityType` (string, optional) — The entity type. Available values: - paypoint - organization - psp (payment service provider).

## Response

### 200

Success

- `isSuccess` (boolean, optional)
- `pageidentifier` (string, optional)
- `responseData` (PaymentMethodDomainApiResponse, optional) — Data related to the payment method domain.
- `responseText` (string, optional)

## Errors

### 400 Bad Request Error

Bad request/ invalid data

- `any`

### 400 Bad Request Error

Bad request/ invalid data

- `any`

### 401 Unauthorized Error

Unauthorized request.

- `any`

### 500 Internal Server Error

Internal API Error

- `any`

### 503 Service Unavailable Error

Database connection error

- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `responseData` (map from string to any, optional) — The object containing the response data.
- `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'.

## Types

### AddPaymentMethodDomainRequestApplePay

Apple Pay configuration information.

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

### PaymentMethodDomainApiResponse

Data related to the payment method domain.

- `applePay` (ApplePayData, optional) — Details about the status of the Apple Pay service.
- `cascades` (list of CascadeJobDetails, optional) — Data about the domain's cascade status.
- `createdAt` (datetime, optional) — Timestamp of when record was created, in UTC.
- `domainName` (string, optional) — The domain. For example: `subdomain.domain.com` or `domain.com`
- `entityId` (long, optional) — The entity's ID in Payabli.
- `entityType` (string, optional) — The entity type. Available values: - paypoint - organization - psp (payment service provider).
- `id` (string, optional) — The payment method domain's ID in Payabli.
- `ownerEntityId` (long, optional) — 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, optional) — The domain's owner's entity type. Available values: - paypoint - organization - psp (payment service provider).
- `updatedAt` (datetime, optional) — Timestamp of when record was last updated, in UTC.

### ApplePayData

Details about the status of the Apple Pay service.

- `data` (ApplePayStatusData, optional) — Details about the Apple Pay service status.
- `isEnabled` (boolean, optional) — When `true`, Apple Pay 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` (string, optional) — The cascade process status. Available valudes: - 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.

### 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 return by the domain verification URL.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "isSuccess": true,
  "pageidentifier": "pageidentifier",
  "responseData": {
    "applePay": {
      "isEnabled": true
    },
    "cascades": [
      {
        "createdAt": "2022-07-01T15:00:01Z"
      }
    ],
    "createdAt": "2022-07-01T15:00:01Z",
    "domainName": "subdomain.domain.com",
    "entityId": 109,
    "entityType": "paypoint",
    "id": "pmd_12AB",
    "ownerEntityId": 109,
    "ownerEntityType": "organization",
    "updatedAt": "2022-07-01T15:00:01Z"
  },
  "responseText": "responseText"
}
```

**SDK Code**

```python
import requests

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

payload = {}
headers = {
    "requestToken": "<apiKey>",
    "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: {requestToken: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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("{}")

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

	req.Header.Add("requestToken", "<apiKey>")
	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["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/PaymentMethodDomain', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

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("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] 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()
```