Accepting Apple Pay in Your iOS App

    Learn how to create an Apple Merchant ID to use Apple Pay in your apps.

    Using Stripe and Apple Pay vs. in-app purchases

    Apple Pay doesn't replace Apple's In-App Purchase API. You can use any of Stripe's supported payment methods and Apple Pay in your iOS app to sell physical goods (e.g., groceries and clothing) or for services your business provides (e.g., club memberships and hotel reservations). These payments are processed through Stripe and you only need to pay Stripe's processing fee.

    Apple's developer terms require their In-App Purchase API be used for digital "content, functionality, or services", such as premium content for your app or subscriptions for digital content. Payments made using the In-App Purchase API are processed by Apple and subject to their transaction fees.

    Prerequisites

    You'll need an iOS device compatible with Apple Pay and a Mac with Xcode 6.1 or newer installed. You can install or upgrade Xcode in the Mac App Store. You'll also need an Apple Developer Account, as well as a membership in the Apple Developer Program. If you need to become a member, you can do so here.

    Step 1: Register for an Apple Merchant ID

    First, you'll need to obtain an Apple Merchant ID. Start by heading to the Registering a Merchant ID page on the Apple Developer website.

    Fill out the form with a description and identifier. Your description is for your own records and can be modified in the future (we recommend just using the name of your app). The identifier must be unique (across all apps, not just yours) and can't be changed later (although you can always make another one). We recommend using merchant.com.{{your_app_name}}. Save this value for later use when developing your app.

    Step 2: Create a new Apple Pay certificate

    You need to include a certificate in your app to encrypt outgoing payment data. This involves 3 steps:

    1. Obtain a CSR (certificate signing request) file from Stripe
    2. Use this CSR to generate a certificate through Apple
    3. Upload the certificate back to Stripe

    First, head to the Apple Pay Settings page in the Dashboard. Choose Add new application and download the .certSigningRequest file.

    Next, back on the Apple Developer site, visit the Add iOS Certificate page. Choose Apple Pay Certificate from the options and click Continue. On the next page, choose the Merchant ID you created earlier from the dropdown and continue.

    The next page explains that you can obtain a CSR from your Payment Provider (which at this point you've done already) or create one manually. Important note: you must use the CSR provided by Stripe - creating your own won't work. So ignore the directions at the bottom of this page and continue on.

    You'll be prompted to upload a .certSigningRequest file. Choose the file you downloaded from the Dashboard and continue. You'll see a success page, with an option to download your certificate. Download it. Finally, return to the Dashboard and upload this .cer file to Stripe.

    Step 3: Integrate with Xcode

    The last step of this process is to add the Apple Pay capability to your app. In Xcode, open your project settings, choose the Capabilities tab, and enable the Apple Pay switch. You may be prompted to log in to your developer account at this point. Enable the checkbox next to the merchant ID you created earlier, and you're done!

    Xcode capabilities pane

    Enable the Apple Pay capability in Xcode

    Troubleshooting

    If you're seeing errors from the Stripe API when attempting to create tokens, there's likely something wrong with your Apple Pay Certificate. You'll need to generate a new certificate and upload it to Stripe, as described above. Make sure you use a CSR obtained from your Dashboard and not one you generated yourself. Xcode often incorrectly caches old certificates, so in addition to generating a new certificate, we recommend creating a new Apple Merchant ID as well.

    If you receive the error "You haven't added your Apple merchant account to Stripe", it's likely your app is sending data encrypted with a previous (non-Stripe) CSR/Certificate. Make sure any certs generated by non-Stripe CSRs are revoked under your Apple Merchant ID. If this does not resolve the issue, delete the merchant ID in your Apple account and recreate it. Then, create a new certificate based on the same (Stripe-provided) CSR that was previously used. You do not need to re-upload this new certificate to Stripe. Once done, toggle the Apple Pay Credentials off and on in your app to make sure they refresh properly.

    Next steps

    You're now ready to start writing payment code and charging your users using Apple Pay. For next steps, including code examples, see our iOS tutorial.

    Was this page helpful? Yes No

    Send

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    Questions?

    We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    On this page