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

The In-App Payments SDK integrates seamlessly with the PassKit framework from Apple, which allows mobile apps to accept Apple Pay payments. Once a customer authorizes the app to charge a card in their digital wallet, the In-App Payments SDK returns a one-time-use nonce for payment processing.

A typical checkout sequence for Apple Pay with the In-App Payments SDK follows these steps:

  1. If Apple Pay is available on the device, the mobile app shows a button that allows the customer to checkout using Apple Pay.
  2. Once the customer taps on the button, the mobile app creates a PKPaymentRequest object, which includes: an Apple merchant identifier, the items being sold, and the total amount.
  3. The PKPaymentRequest is used to instantiate a PKPaymentAuthorizationViewController, which the mobile app presents so the customer can authorize the payment.
  4. If payment is authorized, PassKit returns a PKPayment object.
  5. The PKPayment is used to create a SQIPApplePayNonceRequest.
  6. The In-App Payments SDK uses the SQIPApplePayNonceRequest to exchange the PKPayment for a nonce via an asynchronous network call.
  7. Once the PKPayment data is processed, the In-App Payments SDK triggers a callback to the mobile app and provides the nonce as a callback parameter.
  8. The mobile app can then use the nonce to charge the card.
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