# Apple Pay

Apple Pay is a mobile payment and digital wallet service made by Apple. It lets users make payments in iOS apps, on the web using Safari, and in-person contactless payments via their smartphones, smartwatches, or tablets.

The actual payment method depends on the card information that the user adds to their Apple Pay account. Their card information is stored for future purchases, making it easier to pay for their next order. This is also known as [payment tokenization](https://monei.com/blog/what-is-tokenization/). Payment information is securely transferred from the cardholder to us, so we can authorize and complete the payment.

Apple Pay complies with the [PSD2 and Strong Customer Authentication (SCA) regulations](https://monei.com/blog/psd2/). The payment is only completed when the customer uses their fingerprint or face recognition feature.

Our technology automatically detects whether your customer is paying from an Apple device using Safari (iPhone, iPad, or a Mac with Touch ID). The Apple Pay button is only shown as a payment method to shoppers paying from an Apple Pay enabled device. After they select Apple Pay as the payment method, the payment is completed with the Touch ID or Face ID, creating a seamless experience for the customer.

If your customers have questions about how to set up Apple Pay on an iPhone, Apple Watch, iPad, or Mac computer, you can share [this Set up Apple Pay support article](https://support.apple.com/en-gb/HT204506) for more information.

## Availability[​](#availability "Direct link to Availability")

Apple Pay is available in many countries and regions worldwide. See Apple's overview of the [countries and regions that support Apple Pay](https://support.apple.com/en-us/HT207957) for the current list, which Apple keeps up to date.

## Activation[​](#activation "Direct link to Activation")

As soon as your account has been approved, **Apple Pay is enabled by default.** You can go to [MONEI Dashboard → Settings → Payment methods](https://dashboard.monei.com/settings/payment-methods) to make adjustments to your configured payment methods.

Once activated, Apple Pay is available in the [Hosted Payment Page](https://docs.monei.com/integrations/use-prebuilt-payment-page/.md) integration. You can also use the [Payment Request Component](https://docs.monei.com/monei-js/reference/.md#paymentrequest-component) to render the button directly on your website. The Apple Pay button appears automatically for users on an Apple Pay enabled device.

## Fees[​](#fees "Direct link to Fees")

Apple Pay is not technically considered a payment method. It's a payment [tokenization](https://monei.com/blog/what-is-tokenization/) method. The actual payment method used depends on the credit or debit cards the consumer adds to their Wallet app. There are no extra costs to accept Apple Pay through MONEI — you only pay the regular card fees. There are also no extra transaction fees from Apple Pay.

For current rates, see [Pricing](https://docs.monei.com/manage-account/monei-fees/.md).

## Payouts[​](#payouts "Direct link to Payouts")

Technically speaking, Apple Pay payments are card payments. Apple Pay is the digital wallet consumers use to store their card information. For this reason, the payout process is the same as card settlements and there are no additional transaction fees. Learn more about [settlements and when you get paid](https://docs.monei.com/manage-account/payouts-and-settlements/.md).

## Integration[​](#integration "Direct link to Integration")

* Web
* Native iOS App

## Web integration[​](#web-integration "Direct link to Web integration")

You can start accepting Apple Pay payments on the Web using [Hosted Payment Page](https://docs.monei.com/integrations/use-prebuilt-payment-page/.md) or [Payment Request Component](https://docs.monei.com/monei-js/reference/.md#paymentrequest-component). No additional configuration is required to use Apple Pay in Hosted Payment Page.

Our [Payment Request Component](https://docs.monei.com/monei-js/reference/.md#paymentrequest-component) gives you a single integration for Apple Pay and Google Pay. Customers see a Google Pay or an Apple Pay button, depending on what their device and browser combination supports.

info

Open this page in Safari to see the Apple Pay button.

[MONEI Component preview](/payment-request-example.html)

If you prefer to integrate directly against the Apple Pay API, follow the [direct API integration guide](#direct-api-integration) below.

### Register your domain with Apple Pay[​](#register-your-domain-with-apple-pay "Direct link to Register your domain with Apple Pay")

If you are using [WooCommerce Plugin](https://docs.monei.com/e-commerce/woocommerce/.md) or [custom domain](https://dashboard.monei.com/settings/custom-domain) with [MONEI Hosted Payment Page](https://docs.monei.com/integrations/use-prebuilt-payment-page/.md) your domain is verified automatically.

To register your domain with Apple, you will need to first verify your ownership of the domain. Go to your [MONEI Dashboard → Settings → Payment methods](https://dashboard.monei.com/settings/payment-methods), choose **Register domain with Apple** and follow the instructions in the popup.

![Register your custom domain with Apple dialog in the MONEI Dashboard settings](/img/dashboard/en/settings-apple-pay-domain-create.png)

Register your custom domain with Apple dialog in the MONEI Dashboard settings

You can also verify your domain with Apple using [MONEI REST API](https://docs.monei.com/apis/rest/apple-pay-domain-register/.md).

### Express checkout[​](#express-checkout "Direct link to Express checkout")

Use express checkout to collect shipping and billing addresses directly in the Apple Pay payment sheet. See the [Express Checkout guide](https://docs.monei.com/integrations/express-checkout/.md) for setup and examples.

### Direct API Integration[​](#direct-api-integration "Direct link to Direct API Integration")

Before you start, you need to:

* Add a card to your Wallet for Safari.
* Serve your application over HTTPS. This is a requirement both in development and in production. One way to get up and running is to use a service like [ngrok](https://ngrok.com/).
* [Register your domain with Apple Pay](#register-your-domain-with-apple-pay), both in development and production.
* Follow [Apples's instructions](https://developer.apple.com/documentation/apple_pay_on_the_web).

Include `monei.js` on your checkout page by adding the script tag to the `head` of your HTML file.

checkout.html

```
<head>

  <title>Checkout</title>

  <script src="https://js.monei.com/v3/monei.js"></script>

</head>
```

Create Apple Pay Session

```
const session = new window.ApplePaySession(3, request);

session.onvalidatemerchant = async (event: any) => {

  try {

    const merchantSession = await monei.api.createApplePaySession({

      accountId: 'MONEI_ACCOUNT_ID',

      displayName: 'Test Merchant',

      domainName: 'example.com',

      validationUrl: event.validationURL

    });

    session.completeMerchantValidation(merchantSession);

  } catch (error) {

    session.abort();

  }

};
```

Exchange Apple Pay token for MONEI Payment Token that can be used to confirm payment.

```
session.onpaymentauthorized = async (event) => {

  // Encode Apple Pay token as a base64 string

  const paymentToken = JSON.stringify(event.payment.token);

  const token = window.btoa(paymentToken);

  try {

    const result = await monei.api.createToken({

      paymentId: '{{payment_id}}',

      paymentMethod: {

        applePay: {token}

      }

    });

    session.completePayment({

      status: window.ApplePaySession.STATUS_SUCCESS

    });

    return moneiTokenHandler(result.paymentToken);

  } catch (error) {

    session.completePayment({

      status: window.ApplePaySession.STATUS_FAILURE

    });

  }

};

session.begin();
```

### Confirm the Payment[​](#confirm-the-payment "Direct link to Confirm the Payment")

After you have obtained the MONEI Payment Token, you can confirm the payment using the token.

```
async function moneiTokenHandler(token) {

  try {

    const result = await monei.confirmPayment({

      paymentId: '{{payment_id}}',

      paymentToken: token

    });

    // At this moment you can show a customer the payment result

    // But you should always rely on the result passed to the callback endpoint

    // on your server to update the order status

    console.log(result);

  } catch (error) {

    console.error(error);

  }

}
```

## Native iOS app integration[​](#native-ios-app-integration "Direct link to Native iOS app integration")

If you're building a native iOS application with Apple Pay, you need to create a custom Apple Pay Payment Processing Certificate. This certificate allows your app to decrypt Apple Pay tokens and process payments through MONEI.

### Create a Custom Certificate[​](#create-a-custom-certificate "Direct link to Create a Custom Certificate")

1. Go to [Settings → Apple Pay certificates](https://dashboard.monei.com/settings/apple-pay-certificates) in your MONEI Dashboard
2. Click **Create certificate** to generate a Certificate Signing Request (CSR)
3. Download the CSR file
4. Go to [Apple Developer Portal - Certificates](https://developer.apple.com/account/resources/certificates/list)
5. Click the **+** button to create a new certificate
6. Select **Apple Pay Payment Processing Certificate**
7. Select your Merchant ID and click Continue
8. Upload the CSR file you downloaded from MONEI
9. Download the generated certificate (.cer file)
10. Return to [MONEI Dashboard](https://dashboard.monei.com/settings/apple-pay-certificates) and upload the certificate to activate it

![Create Apple Pay certificate dialog in the MONEI Dashboard settings, showing the CSR step](/img/dashboard/en/settings-apple-pay-certificates-create.png)

Create Apple Pay certificate dialog in the MONEI Dashboard settings, showing the CSR step

info

The private key is securely generated and stored by MONEI. You never need to handle private keys directly.

Until you upload the .cer file, the certificate stays **Pending activation** on the Apple Pay certificates page.

![Apple Pay certificates page in the MONEI Dashboard settings, listing your registered certificates](/img/dashboard/en/settings-apple-pay-certificates.png)

Apple Pay certificates page in the MONEI Dashboard settings, listing your registered certificates

### Initialize Apple Pay[​](#initialize-apple-pay "Direct link to Initialize Apple Pay")

Create your `PKPaymentRequest` in Swift. The `merchantIdentifier` is provided by MONEI - obtain it from the [Get PaymentMethods](https://docs.monei.com/apis/rest/payment-methods-get/.md) API under `metadata.applePay.merchantId` (both test and production: `merchant.com.monei`):

```
let paymentRequest = PKPaymentRequest()

paymentRequest.merchantIdentifier = "merchant.com.monei" // From MONEI API

paymentRequest.countryCode = "ES"

paymentRequest.currencyCode = "EUR"

paymentRequest.supportedNetworks = [.visa, .masterCard, .amex]

paymentRequest.merchantCapabilities = .capability3DS

paymentRequest.paymentSummaryItems = [

    PKPaymentSummaryItem(label: "Your Store Name", amount: NSDecimalNumber(value: 10.00))

]
```

### Process Payments[​](#process-payments "Direct link to Process Payments")

Once the user authorizes the payment, you'll receive a `PKPayment` object. Send the payment token to your backend, then use the MONEI API to process it:

1. Base64 encode the Apple Pay token from `payment.token.paymentData`
2. Create a MONEI payment token using the Create Token API
3. Confirm the payment using the token

```
// In your PKPaymentAuthorizationViewControllerDelegate

func paymentAuthorizationViewController(

    _ controller: PKPaymentAuthorizationViewController,

    didAuthorizePayment payment: PKPayment,

    handler completion: @escaping (PKPaymentAuthorizationResult) -> Void

) {

    // Send payment.token.paymentData to your backend

    let tokenData = payment.token.paymentData.base64EncodedString()

    // Your backend calls MONEI API to process the payment

}
```

On your backend, exchange the Apple Pay token for a MONEI payment token and confirm the payment.

## Before you go live[​](#before-you-go-live "Direct link to Before you go live")

* Make sure that you are using [live (production) mode](https://docs.monei.com/testing/.md) Account ID and API Key.
* Make sure that you have at least one [enabled card processor](https://dashboard.monei.com/settings/payment-methods/card).

## Common questions[​](#common-questions "Direct link to Common questions")

### How do I activate Apple Pay?[​](#how-do-i-activate-apple-pay "Direct link to How do I activate Apple Pay?")

As soon as your account has been approved, **Apple Pay is enabled by default.** See [Activation](#activation) for details.

### What happens after I activate Apple Pay?[​](#what-happens-after-i-activate-apple-pay "Direct link to What happens after I activate Apple Pay?")

Apple Pay becomes available in the [Hosted Payment Page](https://docs.monei.com/integrations/use-prebuilt-payment-page/.md) integration, and you can also use the [Payment Request Component](https://docs.monei.com/monei-js/reference/.md#paymentrequest-component) to render the button directly on your website. The Apple Pay button appears automatically for users on an Apple Pay enabled device.

### Are there extra fees for Apple Pay?[​](#are-there-extra-fees-for-apple-pay "Direct link to Are there extra fees for Apple Pay?")

No. There are no extra costs to accept Apple Pay through MONEI and no extra transaction fees from Apple Pay — you only pay the regular card fees. See [Fees](#fees).

### How are Apple Pay transactions paid out to me?[​](#how-are-apple-pay-transactions-paid-out-to-me "Direct link to How are Apple Pay transactions paid out to me?")

Apple Pay payments are card payments, so the payout process is the same as card settlements with no additional transaction fees. See [Payouts](#payouts).
