JavaScript Reference - Unified Click to Pay
Visa Click to Pay
JavaScript Reference - Unified Click to Pay
Integration Overview
Unified Click to Pay provides quick integration with partners and merchants who want to accept payments from consumers. You can integrate Unified Click to Pay within your existing website pages and implement business and event logic using programming languages, tools, and techniques in the same way you currently do. For this reason, Unified Click to Pay is quite flexible and imposes very few requirements for use.
JavaScript Library
Use the sdk.js Unified Click to Pay JavaScript library to control the operation of Unified Click to Pay on your site.
The Javascript SDK endpoint to use depends on whether you want to run in sandbox or production environment.
URL Parameters
The following parameters are required to be passed while invoking the SDK as URL parameters.
| Query Parameters | R/C/O | Description |
| dpaId
Type: String
Max Length = 255 | R | Reference identifier of the DPA. Based on the previously generated identifier during the DPA registration process. DPA can either be a merchant or partner. |
| cardBrands
Type: String | R | List of card schemes the merchant accepts.
It is a comma separated string with the following supported values.
- visa
- mastercard
Example, “visa, mastercard”. |
| dpaClientId
Type: String | C | Reference identifier of the merchant. Based on the previously generated identifier during the DPA registration process. This DPA will always be a merchant and not a partner.
Conditionality: Required when the dpaId is representing a partner and has multiple merchants on boarded via the partner. This reference identifier will represent the merchant on boarded via the partner. |
JavaScript Methods
- initialize()
- getCards()
- checkout()
- initiateIdentityValidation()
- unbindAppInstance()
initialize
This method initializes the app with common state. The initialize method must be called before any other methods. It is synchronous in operation.
Request Parameters
| Name | R/C/O | Description |
|---|---|---|
| dpaTransactionOptions Type: DpaTransactionOptions |
O | These options can be used to override transaction options for the DPA that were configured during the DPA Registration. |
Application Errors
| Reason Code | Description |
|---|---|
| AUTH_INVALID | Invalid federated id token. |
| ACCT_INACCESSIBLE | The user account exists but is not currently accessible. |
| ACCT_FRAUD | The user account was locked or disabled. |
| CONSUMER_ID_MISSING | The consumerIdentity parameter is missing. |
| CONSUMER_ID_FORMAT_UNSUPPORTED | Unsupported consumer identity type. |
| CONSUMER_ID_FORMAT_INVALID | Invalid consumer identity. |
checkout
This method performs checkout using the specified Digital Card or PAN. If successful, the response contains summary checkout information and, conditionally, an encrypted payload signed by the SRC System containing PCI and/or PII data.
Request Parameters
| Field | R/C/O | Description |
|---|---|---|
| srcDigitalCardId Type: String |
C | A reference identifier of the card to be used for checkout. Conditionality: Required for checkout when a card is selected from a candidate list. Note: If srcDigitalCardId and encryptedCard both are provided then srcDigitalCardId takes precedence. |
| encryptedCard Type: JWE< Card > |
C | The card being enrolled with the SRC System. Encrypted using a public key that is shared with the partner during onboarding. Conditionality: Required for a combined flow where this card is being enrolled during checkout. Note: If srcDigitalCardId and encryptedCard both are provided then srcDigitalCardId takes precedence. |
Response Attributes
| Field | R/C/O | Description |
|---|---|---|
| actionCode Type: ActionCode enum |
R | A code indicating the behavior to be handled by the SRC Initiator. Values applicable: - SUCCESS - ERROR |
| checkoutResponse Type: JWS |
C | Signed checkout response. Conditionality: Required when the actionCode is set to SUCCESS. |
initiateIdentityValidation
This method initiates a process to validate that the consumer is in possession of, or has access to, the consumer identity.
Request Parameters
| Field | R/C/O | Description |
|---|---|---|
| requestedValidationChannelId Type: String |
O | Identifier of the channel over which the identity validation should be initiated. |
Application Errors
| Reason Code | Description |
|---|---|
| OTP_SEND_FAILED | The OTP could not be sent to the recipient. |
| RETRIES_EXCEEDED | The limit for the number of retries exceeded. |
| ACCT_INACCESSIBLE | The user account exists but is not currently accessible. |
unbindAppInstance
This method unbinds a device identity (an application instance) from an SRC profile.