Stripe users can accept Apple Pay in iOS applications in iOS 9 and above, and on the web in Safari starting with iOS 10 or macOS Sierra. There are no additional fees to process Apple Pay payments, and the pricing is the same as other card transactions. Show
Apple Pay is compatible with most Stripe products and features (for example, subscriptions). Use it to accept payments for physical or digital goods, donations, subscriptions, and more (you can’t use Apple Pay instead of in-app purchases though). Apple Pay is available to cardholders at participating banks in supported countries. Refer to Apple’s participating banks documentation to learn which banks and countries are supported. Using Stripe and Apple Pay versus in-app purchasesApple 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 (for example, groceries and clothing) or for services your business provides (for example, 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. Accept Apple PayStripe offers a variety of methods to add Apple Pay as a payment method. For integration details, select the method you prefer: Native iOS React Native iOS Web With the Stripe iOS SDK, you can accept both Apple Pay and traditional credit card payments. Before starting, you need to be enrolled in the Apple Developer Program. Next, follow these steps:
Set up StripeServer-sideClient-sideFirst, you need a Stripe account. Register now. Server-sideThis integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server: Ruby Python PHP Java Node Go .NET Command Line Client-sideThe Stripe iOS SDK is open source, fully documented, and compatible with apps supporting iOS 13 or above. Swift Package Manager CocoaPods Carthage Manual Framework To install the SDK, follow these steps: "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository. When your app starts, configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API. Swift Objective-C AppDelegate.swift "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" Use your test mode keys while you test and develop, and your live mode keys when you publish your app. Register for an Apple Merchant IDObtain an Apple Merchant ID by registering for a new identifier on the Apple Developer website. Fill out the form with a description and identifier. Your description is for your own records and you can modify it in the future. Stripe recommends using the name of your app as the identifier (for example, 2). Create a new Apple Pay certificateCreate a certificate for your app to encrypt payment data. In the Dashboard’s Apple Pay Settings, click Add new application and follow the guide. Download a Certificate Signing Request (CSR) file to get a secure certificate from Apple that allows you to use Apple Pay. Note that one CSR file mist be used to issue exactly one certificate. If you switch your Apple Merchant ID, you must go to the Dashboard’s Apple Pay Settings to obtain a new CSR and certificate. Integrate with XcodeAdd the Apple Pay capability to your app. In Xcode, open your project settings, click the Signing & Capabilities tab, and add the Apple Pay capability. You might be prompted to log in to your developer account at this point. Select the merchant ID you created earlier, and your app is ready to accept Apple Pay. Enable the Apple Pay capability in Xcode Check if Apple Pay is supportedIf you’re using "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" Before displaying Apple Pay as a payment option in your app, determine if the user’s device supports Apple Pay and that they have a card added to their wallet: Swift Objective C CheckoutViewController.swift Create the payment requestWhen the user taps the Apple Pay button, call StripeAPI paymentRequestWithMerchantIdentifier:country:currency: to create a PKPaymentRequest. Then, configure the 5 to display your business name and the total. You can also collect information like billing details or shipping information. See Apple’s documentation for full guidance on how to customize the payment request. Swift Objective C CheckoutViewController.swift Present the payment sheetCreate an STPApplePayContext instance with the 5 and use it to present the Apple Pay sheet: Swift Objective C CheckoutViewController.swift Submit the payment to StripeServer-sideMake an endpoint that creates a PaymentIntent with an amount and currency. Always decide how much to charge on the server side, a trusted environment, as opposed to the client side. This prevents malicious customers from choosing their own prices. curl Ruby Python PHP Java Node Go .NET Command Line sk_test_Ou1w6LVt3zmVipDVJsvMeQsc Client-sidePayment Intents API Payment Intents API (Server-side confirmation) Implement "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" After you call the completion block, 8 completes the payment, dismisses the Apple Pay sheet, and calls 9 with the status of the payment. Implement this method to show a receipt to your customer. Swift Objective C CheckoutViewController.swift Finally, handle post-payment events to do things like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow. TroubleshootingIf you’re seeing errors from the Stripe API when attempting to create tokens, you most likely have a problem with your Apple Pay Certificate. You’ll need to generate a new certificate and upload it to Stripe, as described on this page. 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, Stripe recommends creating a new Apple Merchant ID as well. If you receive the error:
it’s likely your app is sending data encrypted with a previous (non-Stripe) CSR/Certificate. Make sure any certificates generated by non-Stripe CSRs are revoked under your Apple Merchant ID. If this doesn’t resolve the issue, delete the merchant ID in your Apple account and re-create it. Then, create a new certificate based on the same (Stripe-provided) CSR that was previously used. You don’t need to upload this new certificate to Stripe. When finished, toggle the Apple Pay Credentials off and on in your app to ensure they refresh properly. App ClipsThe 0 module is a lightweight Stripe SDK optimized for use in an App Clip. Follow the above steps to add the 0 module to your App Clip’s target. The "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" Migrating from STPApplePayContextIf you’re an existing user of 8 and wish to switch to the lightweight Apple Pay SDK, follow these steps:
Before After
Recurring paymentsIn iOS 16 or later, you can adopt merchant tokens by setting the 6 or 7 properties on 5. Swift Objective C CheckoutViewController.swift To learn more about how to use recurring payments with Apple Pay, see Apple’s PassKit documentation. Order trackingTo adopt order tracking in iOS 16 or later, implement the 9 function in your 1. Stripe calls your implementation after the payment is complete, but before iOS dismisses the Apple Pay sheet. In your implementation:
To learn more about order tracking, see Apple’s Wallet Orders documentation. Swift Objective C CheckoutViewController.swift "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H" Testing Apple PayStripe test card information can’t be saved to Wallet in iOS. Instead, Stripe recognizes when you’re using your test API keys and returns a successful test card token for you to use. This allows you to make test payments using a live card without it being charged. Can Safari use Apple Pay?You can easily and securely shop on your Mac in Safari using Apple Pay. Look for Apple Pay when you check out, then complete your purchase using your Mac with Touch ID, iPhone (iOS 10 or later), or Apple Watch (watchOS 3 or later).
Why does Apple Pay not work on Safari?Activate Apple Pay in Safari
If you keep running into the same issue while making web purchases on your Mac, select Safari > Preferences > Privacy on the macOS menu bar and ensure that the checkbox next to Allow websites to check for Apple Pay and Apple Card is active.
How do I set up Apple Pay on Safari?How to add a debit or credit card for Apple Pay on your Mac or iPad. Open Wallet settings on your device. On your Mac model with Touch ID, go to System Preferences > Wallet & Apple Pay. ... . Tap Add Card. 3,4. Follow the steps on the screen to add a card.. Verify your information with your bank or card issuer.. Can I use Apple Pay on a website on my phone?How do I use Apple Pay? You can use Apple Pay to make purchases in stores, on websites, and in apps.
|