Integrate With Digital Wallets
Use digital wallets like Apple Pay and Google Pay with In-App Payments SDK
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:
- The mobile app gets a Google Pay client instance (
- The mobile app uses
PaymentsClientto check the Google Pay configuration for supported card networks and payment method.
- The mobile app enables the Google Pay button if Google Pay is available and ends the process flow otherwise.
- 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.
- The mobile app sends the Google Pay payment token to In-App Payments SDK to exchange it for a valid Square nonce.
- The mobile app completes the payment flow normally with the returned nonce.
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:
- If Apple Pay is available on the device, the mobile app shows a button that allows the customer to checkout using Apple Pay.
- 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.
PKPaymentRequestis used to instantiate a PKPaymentAuthorizationViewController, which the mobile app presents so the customer can authorize the payment.
- If payment is authorized, PassKit returns a PKPayment object.
PKPaymentis used to create a SQIPApplePayNonceRequest.
- The In-App Payments SDK uses the
SQIPApplePayNonceRequestto exchange the
PKPaymentfor a nonce via an asynchronous network call.
- Once the
PKPaymentdata is processed, the In-App Payments SDK triggers a callback to the mobile app and provides the nonce as a callback parameter.
- The mobile app can then use the nonce to charge the card.