Verify a Buyer

Link to section

Overview

The In-App Payment SDK supports the Strong Customer Authentication (SCA) buyer verification flow for transactions where the buyer is present. When a buyer uses a payment card issued in a region that requires SCA, the issuing bank might require your In-App Payments SDK application to challenge the buyer for additional identifying information. This can happen in a one-time charge when a card is stored on file with Square or when a stored card is used in a transaction.

Complete the following steps to add the SCA flow to your application. The In-App Payments SDK handles all the buyer verification logic and the verification UI. You provide the location ID, buyer contact name, and payment ID (the payment token or stored customer payment card ID) to the buyer verification method and the SDK completes the SCA flow to return a verification token to your application.

Link to section

Requirements and limitations

Complete the steps in Build on iOS.

Link to section

1. Install the SDK

Link to section

Cocoapod installation

Install with CocoaPods by adding the following to your Podfile:

use_frameworks! pod "SquareInAppPaymentsSDK" pod "SquareBuyerVerificationSDK" ## Optional
Link to section

Manual installation

  1. Add the SquareBuyerVerificationSDK SDK to your project:
    1. Open the General tab for your application target in Xcode.
    2. Drag the newly downloaded SquareBuyerVerificationSDK.framework into the Embedded Binaries section.
    3. Choose Copy Items if Needed, and then choose Finish in the dialog box that appears.
Link to section

2. Prepare for the verification flow

  1. Create a SQIPVerificationParameters object to encapsulate the information in the following list:

    • SQIPContact - You should build the SQIPContact object with as many contact field values as possible, including givenName, familyName, and city. The more complete the contact object, the lower the chance that the buyer is challenged by the card-issuing bank.

    • Payment source ID - This ID can be the payment token returned by the CardEntry view controller or a card-on-file ID for the buyer's payment card stored with Square.

    • Location ID - The location IDs are found on the Locations page for your application in the Developer Console. The ID references a seller location and stores the physical address of the seller.

    • Buyer action - The buyer's intention of storing the card on file or charging it.

  2. Pass it into the In-App-Payments SDK buyer verify method in step 3.

  3. Create a SQIPTheme. You must provide a theme to style the verification challenge controller that SQIPBuyerVerificationSDK starts if the card-issuing bank needs to get more identifying information from the buyer. To learn more about creating a theme, see Customize the Payment Entry Form.

Link to section

3. Verify a buyer

Important

SCA should be called for all customer-initiated transactions, including digital wallet payments. If the seller doesn't have SCA called for digital wallet payments, the transactions might be declined due to lack of authentication.

Complete this step if your application stores a buyer's payment card after the buyer enters the card information in the card entry view controller.

Did you know?

If your application uses Apple Pay, the verify function should be called in the paymentAuthorizationViewControllerDidFinish method (and not in the didAuthorizePayment method) after the buyer dismisses Apple Wallet. Buyer verification won't occur if the Apple Wallet overlay is being displayed.

In this example, note the following:

  1. The buyer's action is set to buyerAction: .store().
  2. The verification token is passed to the success completion handler of the verify function.
  3. A cURL command is printed with the verification token, card payment token, and customer ID. The command gives an example of the Cards API CreateCard operation.

For information about storing a customer card on file after the payment token has been verified, see Manage cards on file.

Link to section

4. Charge the payment token or customer card ID

Note

In production, the CreateCard and CreatePayment operations are run on your backend after your client provides the payment token and verification token.

Verify the buyer payment card and send the resulting verification token and the payment source ID (the payment token or stored customer payment card ID) to your backend to complete a payment with verification.

In this example, note the following:

  1. The buyer action is set to buyerAction: .charge(SQIPMoney).
  2. The verification token is passed to the success completion handler of the verify function.
  3. A cURL command is printed with the verification token, payment source ID, and SQIPMoney. The command gives an example of the Payments API CreatePayment operation.