Skip to main content

Checkout with the payonic-click2pay.js client

This method allows to checkout with either a digital card which were returned by Init or Authenticate or checkout and enroll a new card.

If checking out with a new card the caller should supply either a card object with the pan, expiryMonth, and expiryYear or an encrypted card returned by the EncryptCard method.

Returns a checkout id which can be used to get the checkout data. This needs to be done server side, as it requires your API key.

CheckoutParams

digitalCardId String

If checking out with a card returned either by Init or Authenticate, use the id of the card.

transactionAmount Number

Transaction amount given in the format corresponding to the ISO 4217 currency code specified by transactionCurrencyCode.

Maximum length is 18. Final amount must be passed for Installments. For example, if the currency is USD, a transaction of $100 would be given as ‘100.00’.

currencyCode String

String specifying the ISO 4217 currency code (e.g., USD). Minimum length is 3.

rememberMe Boolean

Whether to remember the user on the device.

enrollNewCard Boolean

If an encrypted card or a raw card is passed to be enrolled.

encryptedCard String

Encrypted card to be enrolled in click to pay.

email String

Email of the user whom is enrolled or are to be enrolled.

phone String

Phone number of the user whom is enrolled or are to be enrolled.

forceAuthentication Boolean

Whether to do authentication with click 2 pay.

cardBrand String

Conditional of enrollNewCard is set to true. The brand of the card which is to be enrolled.

acquirerBIN String[]

Conditional of forceAuthenticate is set to true.

acquirerMerchantId String[]

Conditional of forceAuthenticate is set to true.

merchantCountryCode String[]

Conditional of forceAuthenticate is set to true. The country code of the merchant

merchantCategoryCode String[]

Conditional of forceAuthenticate is set to true. The merchant category code

Checkout with digitalCarId
payonicClickToPay.Checkout({
digitalCardId: "8d070e67-8503-4260-8f7f-ed574e36d9c6",
transactionAmount: 100.00
currencyCode: "DKK",
rememberMe: z.boolean(),
enrollNewCard: false,
email: "test@test.com",
phone: "+4512345678",
forceAuthentication: z.boolean(),
cardBrand: z.string().optional(),
acquirerBIN: z.string().optional(),
acquirerMerchantId: z.string().optional(),
merchantCountryCode: z.string().optional(),
merchantCategoryCode: z.string().optional()
});
Checkout with encrypted card
payonicClickToPay.Checkout({
transactionAmount: 100.00
currencyCode: "DKK",
rememberMe: z.boolean(),
enrollNewCard: true
encryptedCard: "eyJrZXlJZCI6IjE0OTA2NC1zdGctc3JjLWZwYW4tZW5jcnlwdGlvbiIsImlhdCI6IjE2MTQ5NDM4NTYiLCJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0",
email: "test@test.com",
phone: "+4512345678",
forceAuthentication: z.boolean(),
cardBrand: z.string().optional(),
acquirerBIN: z.string().optional(),
acquirerMerchantId: z.string().optional(),
merchantCountryCode: z.string().optional(),
merchantCategoryCode: z.string().optional()
});
Checkout with card
payonicClickToPay.Checkout({
transactionAmount: 100.00
currencyCode: "DKK",
rememberMe: z.boolean(),
enrollNewCard: true
card: {
primaryAccountNumber: "5186001700008785",
panExpirationMonth: "01"
panExpirationYear: "28",
cardSecurityCode: "123"
}
email: "test@test.com",
phone: "+4512345678",
forceAuthentication: z.boolean(),
cardBrand: z.string().optional(),
acquirerBIN: z.string().optional(),
acquirerMerchantId: z.string().optional(),
merchantCountryCode: z.string().optional(),
merchantCategoryCode: z.string().optional()
});
Reponse
{
checkoutResultCode: "COMPLETE";
checkoutId?: "Z7NWVCUWZ2QP"
}

CheckoutResultCodes includes:
COMPLETE - checkout processing completed normally
CANCEL - consumer wishes to cancel the flow.
ERROR - an error was detected and the checkout processing cannot continue.
CHANGE_CARD - consumer wishes to select an alternative card. You should return them to the Card Selection List.
ADD_CARD - Consumer wishes to add a new card. You should show the Cart Input form.
SWITCH_CONSUMER - Consumer wishes to change account profile / identity. You should show the Login screen.