Strong Customer Authentication for API Payments

This guide is only relevant to sponsored model clients.

To make payments using our API, sponsored model clients are required to apply Strong Customer Authentication (SCA) when making payments on behalf of their customers. If you are in-scope, this guide outlines the changes needed to your payment workflow to accommodate the additional authentication.

Workflow diagram

collections

Step 1: Ensure that we have the correct phone number

When you initiate the payment process on behalf of your customers, we will send a one-time password (OTP) via SMS to your customer that you will need to provide in a subsequent request header. It is therefore crucial that we have the correct mobile phone number for your customers.

Use the Find Contacts endpoint to view the mobile number we hold and use Update Contact to update the mobile_phone_number field, if necessary.

Step 2: Validate the Payment

Before initiating a payment, call the Validate Payment endpoint, passing the payment details. Set the Boolean header, x-sca-opt-in, to true if you have been informed by Currencycloud that your service model is in-scope for SCA for API payments. If the payment passes the validation and you are in-scope for SCA then your customer will receive a OTP via SMS to their phone which is valid for 10 minutes. The response object will contain the following headers:

Header NameDescription
x-sca-idUUID for the SCA request.  This will need to be sent when the payment is created.
x-sca-typeThe type of 2FA that was used - SMS or NONE.
x-sca-requiredIndicates whether SCA is required for the payment -true or false.

Calling the Validate Payment endpoint subsequent times will send a new OTP SMS.

Example Response:

Content-Type: application/json
x-sca-id: 123e4567-e89b-12d3-a456-426614174000
x-sca-type: SMS
x-sca-required: true
{
    "validation_result": "success"
}

Error Codes (sca_check_failed)

HTTP 400

Error CodeError MessageDescription
invalid_beneficiaryBeneficiary could not be found for given id.Beneficiary not found.
invalid_extra_x_sca_idValidate request should not include x-sca-id in header.x-sca-id header provided in request during validate process.
missing_accountAccount could not be found for given id.Account data could not be found.
amount_type_is_wrongAmount should be of numeric type.Amount in request body is not a numeric.

HTTP 401

Error CodeError MessageDescription
internal_server_errorAuthentication failed with the supplied credentialsCouldn’t authenticate with the provided x-auth-token header.

HTTP 422

Error CodeError MessageDescription
internal_server_errorContact has invalid mobile phone numberContact has invalid mobile phone number
internal_server_errorContact doesn’t have mobile phone numberContact doesn’t have mobile phone number

HTTP 429

Error CodeError MessageDescription
internal_server_errorToo many requests for 2FA approval status.Too many SMS notification sent for same payment data.

HTTP 500

Error CodeError MessageDescription
internal_server_errorError getting beneficiary.Error while fetching the beneficiary.
internal_server_errorError validating SCA signature.Unable to generate a signature for the payment request body.
internal_server_errorError getting account.Error while trying to fetch account data.
internal_server_errorError sending 2FA token request.Unable to send SMS.

Step 3: Submit the Payment

When you are ready to make the payment, call our Create Payment endpoint, passing the payment details and the following additional header parameters:

Header NameDescription
x-sca-opt-inSet to true if you have been informed by Currencycloud that your service model is in-scope for SCA for API payments.
x-sca-idThe UUID returned by the Validate Payment request (step 2 above).
x-sca-tokenThe OTP received following the Validate Payment request.

If the OTP is successfully validated, then the payment will be processed.

Error Codes (sca_check_failed)

HTTP 400

Error CodeError MessageDescription
invalid_beneficiaryBeneficiary could not be found for given id.Beneficiary not found.
missing_x_sca_tokenSCA required but no token included in request.x-sca-token header expected but none provided.
invalid_request_bodyInvalid request body for given x-sca-id.Request body doesn’t match the one provided for validate request.
invalid_x_sca_idInvalid x_sca_id.Provided x-sca-id cannot be found in the database.
x-account-identifierAccount could not be found for given id.Account data couldn’t be found.
missing_beneficiaryBeneficiary was not defined in the request.Missing beneficiary id in request body.
missing_amountAmount was not defined.Missing amount in request body.
missing_currencyCurrency was not defined.Missing currency in request body.
mmount_type_is_wrongAmount should be of numeric type.Amount in request body is not of numeric type.

HTTP 401

Error CodeError MessageDescription
sca_requiredPayment denied. Strong Customer Authentication required.x-sca-id header not provided when SCA is needed.
x-sca-tokenInvalid x-sca-token.This occurs in these circumstances:
• the SMS token was not valid
• the 2FA validation was attempted incorrectly more than 5 times
• the SCA attempt was already used to create a payment.
internal_server_errorx-sca-token has expired.Occurs when the 2FA attempt has expired – 10 minutes for SMS and 5 minutes for push notification.
internal_server_errorAuthentication failed.Couldn't authenticate with provided x-auth-token header.

HTTP 429

Error CodeError MessageDescription
internal_server_errorToo many requests for 2FA approval status.Too many attempts to validate SMS token.

HTTP 500

Error CodeError MessageDescription
internal_server_errorError getting beneficiary.Error while fetching the beneficiary.
internal_server_errorInvalid 2FA Type.Error while saving data during the validate process.
internal_server_errorError validating SCA signature.Problem generating signature for payment request body.
internal_server_errorError getting contact.Problem fetching contact data with provided x-auth-token.
internal_server_errorError getting account.Error while fetching account data.
internal_server_errorAn error occurred retrieving 2FA approval status.Couldn’t validate SMS token.