In-App Payments SDK

Integrate With Digital Wallets

Use digital wallets like Apple Pay and Google Pay with In-App Payments SDK

Android
iOS

In-App Payments SDK supports mobile payments with nonces generated from digital wallet apps installed on the device.

Digital wallet setup guides

Google Pay nonce generation flow

To handle payments with Google Pay, mobile apps implement the Google digital wallet using the Google Android Wallet library then use the In-App Payments SDK to request a wallet token and convert it to a nonce that Square can use to process payment:

  1. The mobile app gets a Google Pay client instance (com.google.android.gms.wallet.PaymentsClient).
  2. The mobile app uses PaymentsClient to check the Google Pay configuration for supported card networks and payment method.
  3. The mobile app enables the Google Pay button if Google Pay is available and ends the process flow otherwise.
  4. The mobile app creates a payment request with Square request parameters, sends it to the digital wallet library, and waits for the results of the Google Pay activity.
  5. The mobile app sends the Google Pay payment token to In-App Payments SDK to exchange it for a valid Square nonce.
  6. The mobile app completes the payment flow normally with the returned nonce.
In app payments google pay

Apple Pay nonce generation flow

To handle payments with Apple Pay, mobile apps implement the Apple Pay payment flow using the Apple Pay PassKit framework. The payment flow includes an In-App Payments SDK-generated request on the PassKit framework for an Apple pay token. The resulting token is consumed by In-App Payments SDK to produce a nonce that Square can use to process payment:

The payment flow is customized by creating a PKPaymentRequest object using the squarePaymentRequestWithMerchantIdentifier method. The Apple Pay token that is returned from the request must be converted to a nonce before it can be used to process a payment.

  1. The mobile app uses an app view controller to enable the Apple Pay button if Apple Pay is available and ends the process flow otherwise.
  2. The mobile app creates an Apple Pay payment request that includes an item description, amount, merchant identifier, country code, and currency code.
  3. The mobile app creates a payment authorization view controller, presents it, and waits for the results of user interaction with the view controller.
  4. The mobile app gets the Apple Pay payment token from the delegate invoked by the view controller and sends it to In-App Payments SDK to exchange the payment token for a valid Square nonce.
  5. The mobile app completes the payment flow normally with the returned nonce.
In app payments apple pay

Next Steps

Follow the links below to start integrating digital wallets.

Contact Developer Support, join our Slack channel, or ask for help on Stack Overflow