Search

Are you looking for test card numbers?

Would you like to contact support?

Making payments with tokens

Use tokenized payment information for recurring and subscription payments.

Making a payment

To make a payment using a token, make a /payments request. Include the following values:

  • paymentMethod.recurringDetailReference
  • shopperReference 
  • shopperInteraction set to ContAuth.
{
   "amount":{
      "value":2000,
      "currency":"USD"
   },
   "paymentMethod":{
      "recurringDetailReference":"7219687191761347"
   },
   "reference":"Your Reference Here",
   "merchantAccount":"TestMerchant",
   "returnUrl":"https://your-company.com/...",
   "shopperReference":"yourShopperId_IOfW3k9G2PvXFu2j",
   "shopperInteraction":"ContAuth"
}

A successful payment has a HTTP status of 200 and a resultCode of Authorised.

{
   "pspReference": "8815329842815468",
   "resultCode": "Authorised"
}

Recurring transaction types

Some payment methods require payment requests to be flagged based on whether the shopper was present to enter the payment information themselves at point of payment, which is called a shopper-present transaction. If the shopper didn't enter their information at point of payment and saved details or card on file were used, this is called a shopper-not-present transaction.

Specify the shopper interaction, shopperInteraction, as Ecommerce for shopper-present transactions or ContAuth for shopper-not-present transaction.

Whenever you make a card payment without collecting CVC, you need to specify the shopperInteraction as ContAuth.

Collecting CVV with token

You may want to allow your shoppers to use their previously saved payment details, yet still collect the CVV in order to improve your auth rate and fraud protection.

Step 1: Collect CVV

You can collect your shopper's CVV by:

Use Card Component to collect CVV

Our Card Component can also be configured to collect the CVV if the shopper has a stored payment detail. 

Make sure that you read and understand API with Card Component integration.

 Configure your Card Component with the following additional properties:

    • type: Set an object containing type data.
    • storedDetails: Set an object containing storedDetails data.
    • details: Set an object containing details data.
    • recurringDetailReference: Set an object containing recurringDetailReference data.
    const card = checkout.create("card", {
        // Options
        type: oneClickCardData.type,
        storedDetails: oneClickCardData.storedDetails,
        details: oneClickCardData.details,
        recurringDetailReference: oneClickCardData.recurringDetailReference
    }).mount("#card");
  1. Make a /paymentMethods call to know if the shopper has a stored payment detail.

    • merchantAccount: Your merchant account name. 
    • countryCode: The shopper's country.
    • amount: The currency and value of the payment. 
    • shopperReference: Your unique ID for this shopper.

    If the shopper has a stored payment detail, the oneClickPaymentMethods array will be returned in the response. Pass the data from this array to the card component.

    {
    ...  
      "oneClickPaymentMethods":[  
        {  
          "details":[  
            {  
              "key":"cardDetails.cvc",
              "type":"cvc"
            }
          ],
          "name":"VISA",
          "type":"visa",
          "recurringDetailReference":"8415489254612814",
          "storedDetails":{  
            "card":{  
              "expiryMonth":"8",
              "expiryYear":"2018",
              "holderName":"John Smith",
              "number":"1111"
            }
          }
        }
      ]
    ...
    }
  2. Create a function to listen to and handle the onChange event triggered by the Component: 

    function handleOnChange(state, component) {
        state.isValid // true or false.
        state.data
        /* {type: "scheme", recurringDetailReference: "8315490331750981", encryptedSecurityCode: "adyenjs_0_1_18$MT6ppy0FAMVMLH..."} */
    }
  3. When state.isValid is true, collect the encrypted values passed in the state.data. You'll use these to make the payment.

Use Secured Fields to collect CVV 

Collect CVV on your payment form using our JavaScript library, Secured Fields. See Components for more information.

Step 2: Make a payment with the token and CVV

Make a /payments request, and include the following values:

  • recurringDetailReference
  • encryptedSecurityCode

    If you're collecting raw card data, pass the cardDetails.cvc parameter with the shopper's CVV.

  • shopperReference: Your unique ID for this shopper.
  • shopperInteraction: Set to Ecommerce.
{
  "amount": {
    "value": 2000,
    "currency": "USD"
  },
  "paymentMethod": {
    "type": "scheme",
    "recurringDetailReference": "7219687191761347",
    "encryptedSecurityCode":"adyenjs_0_1_18$MT6ppy0FAMVMLH..."
  },
  "reference": "Your Reference Here",
  "merchantAccount": "TestMerchant",
  "shopperReference": "yourShopperId_IOfW3k9G2PvXFu2j",
  "shopperInteraction":"Ecommerce",
  "returnUrl": "https://your-company.com/..."
}

If the payment was successful you'll receive an Authorised resultCode and a pspReference, our unique identifier for this transaction. 

Next steps