# Register domains for Apple Pay

Add domains to be registered with Apple Pay.

Any domains that will be used to accept payments must first be [verified](https://docs.moov.io/guides/sources/cards/apple-pay/#register-your-domains) with Apple.

To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) you'll need to specify the `/accounts/{accountID}/apple-pay.write` scope.

## POST

/accounts/{accountID}/apple-pay/domains

### Example Requests

Ask

```shell
curl -X POST "https://api.moov.io/accounts/{accountID}/apple-pay/domains" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.04.00"
```

Ask

```go
mc, _ := moov.NewClient()

var accountID string
domains := []string{"checkout.classbooker.dev"}

mc.CreateApplePayDomain(ctx, accountID,
  moov.ApplePayDomains{
    DisplayName: "Example account",
    Domains:     domains,
  })
```

Ask

```typescript
import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.registerMerchantDomains({
    accountID: "60825531-8c7e-421c-8014-019c6603250c",
    registerApplePayMerchantDomains: {
      domains: ["checkout.classbooker.dev"],
    },
  });

console.log(result);
}

run();
```

Ask

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$registerApplePayMerchantDomains = new Components\RegisterApplePayMerchantDomains(
    domains: ["checkout.classbooker.dev"],
);

$response = $sdk->applePay->registerDomains(
    accountID: '60825531-8c7e-421c-8014-019c6603250c',
    registerApplePayMerchantDomains: $registerApplePayMerchantDomains
);

if ($response->applePayMerchantDomains !== null) {
    // handle response
}
```

Ask

```java
package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.RegisterApplePayMerchantDomains;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.RegisterApplePayMerchantDomainsResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

public static void main(String[] args) throws GenericError, Exception {

Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

RegisterApplePayMerchantDomainsResponse res = sdk.applePay().registerMerchantDomains()
                .accountID("60825531-8c7e-421c-8014-019c6603250c")
                .registerApplePayMerchantDomains(RegisterApplePayMerchantDomains.builder()
                    .domains(List.of(
                        "checkout.classbooker.dev"))
                    .build())
                .call();

if (res.applePayMerchantDomains().isPresent()) {
            System.out.println(res.applePayMerchantDomains().get());
        }
    }
}
```

Ask

```python
from moovio_sdk import Moov
from moovio_sdk.models import components

with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

res = moov.apple_pay.register_merchant_domains(account_id="60825531-8c7e-421c-8014-019c6603250c", domains=[
        "checkout.classbooker.dev",
    ])

# Handle response
    print(res)
```

Ask

```ruby
require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
  security: Models::Components::Security.new(
    username: '',
    password: ''
  )
)
res = s.apple_pay.register_merchant_domains(account_id: '60825531-8c7e-421c-8014-019c6603250c', register_apple_pay_merchant_domains: Models::Components::RegisterApplePayMerchantDomains.new(
  domains: [
    'checkout.classbooker.dev',
  ]
))

unless res.apple_pay_merchant_domains.nil?
  # handle response
end
```

Ask

```csharp
using Moov.Sdk;
using Moov.Sdk.Models.Components;
using System.Collections.Generic;

var sdk = new MoovClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.ApplePay.RegisterMerchantDomainsAsync(
    accountID: "60825531-8c7e-421c-8014-019c6603250c",
    body: new RegisterApplePayMerchantDomains() {
        Domains = new List<string>() {
            "checkout.classbooker.dev",
        },
    }
);

// handle response
```

### Response Example

```json
{
  "accountID": "string",
  "displayName": "string",
  "domains": [
    "checkout.classbooker.dev"
  ],
  "createdOn": "2019-08-24T14:15:22Z",
  "updatedOn": "2019-08-24T14:15:22Z"
}
```

### Errors

```json
{
  "error": "string"
}
```
