# Use ApplePay

Place an order using catalog products defined in your Control Panel, and collect the payment using ApplePay.

## Supported currency

Check with 2Checkout support for a list of currencies available for ApplePay.

## Activation

For activation, you need to have Apple Pay enabled on your 2Checkout account. Contact the [Merchant Support](mailto:supportplus@2checkout.com) team in order to enable this. After 2Checkout sets up our domain, we will provide you with a domain verification file.

Host your domain verification file at the following path on your server: https\://\[DOMAIN\_NAME]/.well-known/apple-developer-merchantid-domain-association

## Workflow

1. Initialize an [ApplePay session](https://verifone.cloud/docs/2checkout/API-Integration/01Start-using-the-2Checkout-API/2Checkout-API-general-information/Payment_flow_with_Apple_Pay) using our API.
2. Collect the "ApplePayDataToken" provided by Apple Pay client side and pass it server side to make the **placeOrder** API call.
3. Create the order object. Use APPLE\_PAY as the type in the `PaymentDetails` object and pass the "ApplePayDataToken" through the "ApplePayToken" property in the `PaymentMethod` object. Place the order.

## Request parameters

<table><thead><tr><th width="118">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><p><strong>Required (string)</strong></p><p>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</p></td></tr><tr><td><a href="/pages/ntYqWA3pWPLrpvzTn87M"><code>Order</code></a></td><td><p><strong>Required (object)</strong></p><p>Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.</p></td></tr></tbody></table>

### Request sample

```php
<?php
declare(strict_types=1);
class Configuration
{
    public const MERCHANT_CODE = 'MERCHANT_CODE';
    public const MERCHANT_KEY = 'SECRET_KEY';
    public const URL = 'http://api.avangate.local/soap/6.0';
    public const ACTION = 'placeOrder';

    public const PAYLOAD =  <<<JSON
{
  "Currency": "usd",
  "Language": "en",
  "Country": "us",
  "Source": "API",
  "Affiliate": {
        "AffiliateCode": "ABCDE1234"
  },
  "Items": [\
    {\
      "Code": "K6DHJXGULK",\
      "Quantity": 2\
    }\
],
  "BillingDetails": {
    "Address1": "Test Address",
    "City": "LA",
    "State": "California",
    "CountryCode": "US",
    "Email": "testcustomer@2Checkout.com",
    "FirstName": "Customer",
    "LastName": "2Checkout",
    "Zip": "12345"
  },
  "PaymentDetails":{
      "Type":"APPLE_PAY",
      "Currency":"USD",
      "CustomerIP":"10.10.10.10",
      "PaymentMethod":{
         "ApplePayToken":"ApplePayDataToken"
      }
   }
}
JSON;

}
class Client
{
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?object {
        if (is_array($payload)) {
            $payload = json_encode($payload);
        }
        if (!empty($payload)) {
            // SoapClient works with objects(StdClass)
            $payload = json_decode($payload);
        }
        $soapClient = $this->getClient($url);
        $sessionId = $this->getSession($soapClient);
        $args = array_filter([$sessionId, $payload]);
        return $soapClient->$action(...$args);
    }

    public function getClient(string $url): SoapClient
    {
        return new SoapClient(
            $url.'?wsdl',
            [\
                'location' => $url,\
                'cache_wsdl' => WSDL_CACHE_NONE,\
            ]
        );
    }

    public function getSession(SoapClient $client)
    {
        $date = gmdate('Y-m-d H:i:s');
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $string = strlen($merchantCode).$merchantCode.strlen($date).$date;
        $algo = 'sha256';
        $hash = hash_hmac($algo, $string, $key);
        $client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');
        return $client->login($merchantCode, $date, $hash, $algo);
    }
}
try {
    $client = new Client();
    var_dump($client->call());
} catch (Exception $ex) {
    var_dump($ex);
}
```

## Response parameters

<table><thead><tr><th width="186.2666015625">Parameters</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/010708cd78f3efa4929d4374cb2abe08c3d2b686"><code>Order information</code></a></td><td>Object containing order information.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/place-orders-with-catalog-products/use-applepay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
