How to use apple pay on safari iphone

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.

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.

//stripe.com/docs/development/quickstart bundle add stripe

Client-side

The 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:

  1. In Xcode, select File > Add Packages… and enter

    import UIKit import StripeApplePay @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =

    "pk_test_GvF3BSyx8RSXMK5yAFhqEd3H"

    // do any other necessary launch configuration return true } }

    1 as the repository URL.
  2. Select the latest version number from our releases page.
  3. Add the StripeApplePay product to the target of your app.

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

import UIKit import StripeApplePay @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =

"pk_test_GvF3BSyx8RSXMK5yAFhqEd3H"

// do any other necessary launch configuration return true } }

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 ID

Obtain 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,

import UIKit import StripeApplePay @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =

"pk_test_GvF3BSyx8RSXMK5yAFhqEd3H"

// do any other necessary launch configuration return true } }

2).

Create a new Apple Pay certificate

Create 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 Xcode

Add 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.

"//my-backend.example.com/customer-portal")!) request.recurringPaymentRequest?.billingAgreement = "You'll be billed $59.99 every month for the next 12 months. To cancel at any time, go to Account and click 'Cancel Membership.'" request.paymentSummaryItems = [billing] } }

To learn more about how to use recurring payments with Apple Pay, see Apple’s PassKit documentation.

Order tracking

To adopt order tracking in iOS 16 or later, implement the

func handleApplePayButtonTapped() { let merchantIdentifier = "merchant.com.your_app_name" let paymentRequest = StripeAPI.paymentRequest(withMerchantIdentifier: merchantIdentifier, country: "US", currency: "USD") // Configure the line items on the payment request paymentRequest.paymentSummaryItems = [ // The final line should represent your company; // it'll be prepended with the word "Pay" (that is, "Pay iHats, Inc $50") PKPaymentSummaryItem(label: "iHats, Inc", amount: 50.00), ] // ...continued in next step }

9 function in your

func handleApplePayButtonTapped() { let merchantIdentifier = "merchant.com.your_app_name" let paymentRequest = StripeAPI.paymentRequest(withMerchantIdentifier: merchantIdentifier, country: "US", currency: "USD") // Configure the line items on the payment request paymentRequest.paymentSummaryItems = [ // The final line should represent your company; // it'll be prepended with the word "Pay" (that is, "Pay iHats, Inc $50") PKPaymentSummaryItem(label: "iHats, Inc", amount: 50.00), ] // ...continued in next step }

1. Stripe calls your implementation after the payment is complete, but before iOS dismisses the Apple Pay sheet.

In your implementation:

  1. Fetch the order details from your server for the completed order.
  2. Add these details to the provided

    func handleApplePayButtonTapped() { // ...continued from previous step // Initialize an STPApplePayContext instance if let applePayContext = STPApplePayContext(paymentRequest: paymentRequest, delegate: self) { // Present Apple Pay payment sheet applePayContext.presentApplePay(on: self) } else { // There is a problem with your Apple Pay configuration } }

    1.
  3. Call the provided completion handler on the main queue.

To learn more about order tracking, see Apple’s Wallet Orders documentation.

Swift

Objective C

CheckoutViewController.swift

import UIKit import StripeApplePay @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =

"pk_test_GvF3BSyx8RSXMK5yAFhqEd3H"

// do any other necessary launch configuration return true } }

0

Testing Apple Pay

Stripe 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.

Toplist

Latest post

TAGs