One-Click Payments

One-Click Payments utilize a previously generated payment token to prefill payment details for credit card or invoice payments pages - which means that the payer don't need to enter these details for every purchase. 

Introduction

The main purchase flow and implementation is exactly the same as described in the Redirect and Hosted View scenarios for card and financing invoice payments, the difference being the use of a paymentToken. The details in this section describe explicitly the parameters that must be set to enable one-click purchases.

API requests to generate paymentToken

When making the initial purchase request, you need to generate a paymentToken. You can do this either by by setting generatePaymentToken to true when doing a card purchase, or set the initial operation to Verify.

InstrumentOperationpaymentToken
Credit cardPurchase or VerifyIf Purchase, generatePaymentToken must be set to true. A verification payment generates a paymentToken automatically.
generatePaymentToken property
"generatePaymentToken": "true"

When the purchase is followed through a paymentToken will linked to the payment.  You can return the value by making a GETrequest payment resource (expanding either the authorizations or verifications sub-resource), after the consumer successfully has completed the purchase.

GET https://api.payex.com/psp/creditcard/payments/d23a0e69-3c35-4e6b-cb3c-08d73b3d9f95?$expand=[authorizations|verifications] HTTP/1.1
Host: api.payex.com
paymentToken
"paymentToken": "5adc265f-f87f-4313-577e-08d3dca1a26c",

You need to store the paymentToken in your system and keep track of the corresponding consumer-ID in your system.

Returning purchases

When a known consumer (where you have attained a consumer-ID or similar) returns to your system, you can use the payment token, using already stored payment data, to initiate enable one-click payments. You will need to make a standard redirect purchase, following the sequence as specified in the Redirect scenarios for  credit-card and financing invoice. When making the first POSTrequest you insert the paymentToken attribute. This must be the  paymentToken you received in the initial purchase, where you specified the generatePaymentToken to true.

See the technical reference, for how to create a card and invoice payment.

Request

POST /psp/creditcard/payments HTTP/1.1
Host: api.payex.com
Authorization: Bearer <MerchantToken>
Content-Type: application/json

{
"payment": {
"operation": "Purchase",
"intent": "Authorization",
"paymentToken": "5adc265f-f87f-4313-577e-08d3dca1a26c",
"currency": "SEK",
"prices": [
{
"type": "CreditCard",
"amount": 1500,
"vatAmount": 0
}
],
"description": "Test Purchase",
"payerReference": "AB1234",
"generateRecurrenceToken": "true",
"userAgent": "Mozilla/5.0...",
"language": "sv-SE",
"urls": {
"hostUrls": [
"http://test-dummy.net",
"http://test-dummy2.net"
],
"completeUrl": "http://test-dummy.net/payment-completed",
"cancelUrl": "http://test-dummy.net/payment-canceled",
"callbackUrl": "http://test-dummy.net/payment-callback",
"logoUrl": "",
"termsOfServiceUrl": ""
},
"payeeInfo": {
"payeeId": "22222222-2222-2222-2222-222222222222",
"payeeReference": "AB1234",
"payeeName": "Merchant1",
"productCategory": "A123",
"orderReference": "or123",
"subsite": "MySubsite"
},
"metadata": {
"key1": "value1",
"key2": 2,
"key3": 3.1,
"key4": false
},
"cardholder": {
"firstName": "firstname/companyname",
"lastName": "lastname",
"email": "string",
"msisdn": "",
"homePhoneNumber": "",
"workPhoneNumber": ""
},
"accountInfo": {
"accountAgeIndicator": "01",
"accountChangeIndicator": "01",
"accountPwdChangeIndicator": "01",
"shippingAddressUsageIndicator": "01",
"shippingNameIndicator": "01",
"suspiciousAccountActivity": "01",
"addressMatchIndicator": "false"
}
},
"creditCard": {
"rejectCreditCards": false,
"rejectDebitCards": false,
"rejectConsumerCards": false,
"rejectCorporateCards": false
}
}

When redirecting to PayEx (as specified in the Redirect scenario) the payment page will be prefilled with the payer's card details.

Screenshots

1551694133222-896.png

Delete payment token

Please see Delete payment token

Created by Fredrik Köhler on 2018/10/03 14:56