Enable Secure Remote Commerce - iOS

Applies to: In-App Payments SDK - iOS

Learn how to enable Secure Remote Commerce on an iOS device.

Link to section

Requirements and limitations

To enable SRC with the In-App Payments SDK on iOS, the following must be true:

  • You're a US-based Square seller. SRC for the In-App Payments SDK is only available for Square sellers based in the United States.
  • You've followed the instructions in Build on iOS. This topic doesn't cover the general setup of the In-App Payments SDK.
  • You've read and will adhere to Mastercard brand guidelines.
  • SRC isn't supported in the Square Sandbox.
Link to section

1. Add an SRC button image to your project

Create the image for your Click to Pay button by following the guidance on the Mastercard Branding Requirements page. Choose Use in digital payments and then choose Signaling Mastercard Click to Pay enablement. The image you create should look like the following:

A graphic showing a Secure Remote Commerce button image for Mastercard.

The examples on this page assume that you've created a PNG file (src_logo_button) and added it as an image in Assets.xcassetes.


If you don't obtain an SRC image and store it in your project, you should download the image URL at runtime, convert the image into a PNG, and cache it.

Link to section

2. Show the SRC payment sheet and get a payment token

Taking an SRC payment from your payment view controller involves the following steps:

  1. Create an instance of SQIPSecureRemoteCommerce.

    let secureRemoteCommerce = SQIPSecureRemoteCommerce()
  2. Create a payment request, specifying the payment amount and a completion handler. Replace YourPaymentViewController with the view controller that the payment sheet shows on top of.

    secureRemoteCommerce.createPaymentRequest(YourPaymentViewController, secureRemoteCommerceParameters: SQIPSecureRemoteCommerceParameters(amount: 5.95), completionHandler: { cardDetails, error in // #3 here })
  3. Get the payment token from the completion handler by reading the cardDetails?.nonce property. Replace // #3 here with the following code:

    // If success, completion handler includes the card details, including a nonce. let nonce = cardDetails?.nonce // Otherwise cardDetails will be nil and an error is passed instead. let errorDescription = error?.localizedDescription