# Apple Pay

Apple Pay gives users a fast, secure way to pay with OnsideKit.

{% hint style="warning" %}
Apple Pay is available in the full **OnsideKit** product only. **OnsideKitLite** ships without PassKit, so it has no Apple Pay and the `Onside.applePayMerchantIdentifier` API does not exist there. See [OnsideKit vs OnsideKitLite](/sdk/advanced-and-tooling/onsidekit-lite.md).
{% endhint %}

Enabling Apple Pay takes four steps:

1. Create a **Merchant ID** in Apple Developer.
2. Generate an **Apple Pay Payment Processing Certificate** for that Merchant ID.
3. Send the certificate to Onside.
4. Configure OnsideKit and your app with the same Merchant ID.

## Step 1: Create a Merchant ID

The Merchant ID identifies your Apple Pay merchant configuration. You'll reuse this exact value in your app and in your Onside configuration.

1. Sign in to your Apple Developer account.
2. Open **Certificates, Identifiers & Profiles → Identifiers**.
3. Click **+**, select **Merchant IDs**, and click **Continue**.
4. Enter a unique **Merchant ID**, click **Continue**, review, and click **Register**.

## Step 2: Generate the Apple Pay Payment Processing Certificate

Apple must issue an **Apple Pay Payment Processing Certificate** for your Merchant ID. This requires a **Certificate Signing Request (CSR)** that Onside provides — do **not** create your own CSR.

#### Request the CSR from Onside

Email <merchant-support@onside.io> and include:

* your app name
* your **Merchant ID** from step 1
* your Onside account or publisher name

Keep the CSR file Onside sends you unchanged.

#### Generate the certificate in Apple Developer

1. Sign in to your Apple Developer account.
2. Open **Certificates, Identifiers & Profiles → Identifiers**.
3. Select the **Merchant ID** you created.
4. Open **Apple Pay Payment Processing Certificate** and start the generation flow.
5. Upload the CSR file provided by Onside.
6. Complete the process and download the generated certificate.

{% hint style="info" %}
Apple Developer can show multiple Apple Pay options. For Onside, generate exactly **Apple Pay Payment Processing Certificate**.
{% endhint %}

{% hint style="warning" %}
You must use the CSR from Onside. If you upload a different CSR, Onside cannot use the generated certificate for your integration.
{% endhint %}

## Step 3: Send the certificate to Onside

Onside uses this certificate to decrypt Apple Pay tokens during transactions. Email the generated certificate file to <merchant-support@onside.io> and include:

* the certificate file you downloaded from Apple
* your app name
* your **Merchant ID**
* your Onside account or publisher name

## Step 4: Configure your app

Once Onside has processed your certificate, configure the same Merchant ID in your app.

#### Set the merchant identifier in OnsideKit

Set `Onside.applePayMerchantIdentifier` to your Merchant ID — **after** `Onside.initialize()`, and before you present any purchase UI:

```swift
import OnsideKit

Onside.initialize()
Onside.applePayMerchantIdentifier = "merchant.your.merchant.id"
```

{% hint style="warning" %}
`applePayMerchantIdentifier` must be set after `Onside.initialize()` (the property requires an initialized SDK) and before the first purchase, so Apple Pay is available when the purchase flow starts.
{% endhint %}

#### Enable the Apple Pay capability in Xcode

Adding the capability generates the merchant entitlement your app needs to present Apple Pay:

1. Open your app target and go to **Signing & Capabilities**.
2. Click **+ Capability** and add **Apple Pay**.
3. In the Apple Pay configuration, select the **Merchant ID** from step 1.

Apple Pay now appears as a payment option in the OnsideKit purchase flow. See [Making a Purchase](/sdk/purchasing/making-a-purchase.md).


---

# 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.onside.io/sdk/purchasing/apple-pay.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.
