Skip to main content

Payment flow with test orders

Last updated: 06-Oct-2020
Rate this article:

Overview

The following payment methods are supported for the test order flow: credit cards, 2Pay.js token. For the full list of test credit card details, check this article.

Availability

Available for all 2Checkout accounts.

Test orders with credit cards

Payment method object structure

Field name Type Required/Optional Description

CardNumber 

String

Required

 The number of the test card.

CardType 

String

Optional

Can be Visa, Visa electron, Mastercard, Maestro, Amex, Discover, Dankort, Carte Bancaire, JCB, Hipercard, Elo card.

ExpirationYear 

String

Required

Card expiration year.

ExpirationMonth 

String

Required

Card expiration month.

CCID 

String

Required

The CVV/card security code.

HolderName 

String

Required

Card holder name.

Vendor3DSReturnURL 

String

Required

The URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.

Vendor3DSCancelURL 

String

Required

The URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.

RecurringEnabled

Boolean

Optional

True or False, depending on whether the shoppers checked the subscription auto-renewal checkbox or not, during the purchase process.

Request example

The full JSON used to place an order with credit cards would look like:

{
  "Items": [
    {
      "Code": "5DCB30C6B0",
      "Quantity": 1
    }
  ],
  "BillingDetails": {
    "Email": "example@email.com",
    "FirstName": "Customer First Name",
    "LastName": "Customer Last Name",
    "CountryCode": "US",
    "State": "California",
    "City": "San Francisco",
    "Address1": "Example Street",
    "Zip": "90210"
  },
  "PaymentDetails": {
    "Type": "TEST",
    "Currency": "USD",
    "CustomerIP": "10.10.10.10",
    "PaymentMethod": {
      "CardNumber": "4111111111111111",
      "CardType": "VISA",
      "ExpirationYear": "2023",
      "ExpirationMonth": "12",
      "HolderName": "John Doe",
      "CCID": "123",
      "Vendor3DSReturnURL": "http://yoursuccessurl.com",
      "Vendor3DSCancelURL": "http://yourcancelurl.com"
    }
  },
  "Language": "en",
  "Country": "US",
  "CustomerIP": "10.10.10.10",
  "Source": "Website",
  "ExternalCustomerReference": "externalCustomerId",
  "Currency": "USD",
  "MachineId": "123456789"
}

The API will respond with the full order object (for orders placed successfully) or an error message.

Test Orders with 2Pay.js Token

The 2Pay.js tokens generated using the 2Pay.js library can be used to place test orders as well.

Payment method object structure

Field name Type Required/Optional Description

EesToken

String

Required

The 2Pay.js token obtained by integrating the 2Pay.js library.

Vendor3DSReturnURL 

String

Required

The URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.

Vendor3DSCancelURL 

String

Required

The URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.

 Request example

{
   "Language":"en",
   "Country":"US",
   "CustomerIP":"10.10.10.10",
   "Source":"Website",
   "ExternalCustomerReference":"externalCustomerId",
   "Currency":"USD",
   "MachineId":"123456789",
   "Items":[
      {
         "Code": "5DCB30C6B0",
         "Quantity":1
      }
   ],
   "BillingDetails":{
      "FirstName":"Customer First Name",
      "LastName":"Customer Last Name",
      "CountryCode":"US",
      "State":"California",
      "City":"San Francisco",
      "Address1":"Example Street",
      "Zip":"90210",
      "Email":"example@email.com"
   },
   "PaymentDetails":{
      "Type":"TEST",
      "Currency":"USD",
      "PaymentMethod":{
         "EesToken":"0cd06e64-ea85-4240-88f1-ab0edc298f08",
         "Vendor3DSReturnURL":"https:\/\/example.com",
         "Vendor3DSCancelURL":"https:\/\/example.com"
      }
   }
}

2Pay.js Token Validity 

The security limitations that apply to the 2Pay.js token are present on the test payment method as well:

  • 10 minutes time limit - orders can only be placed within 10 minutes after the token has been generated
  • One order per token - once a token has been used to place an order (be it successful or not), then this is flagged as used and cannot be used again to place an order (a new token needs to be generated).

Notes on test orders

  • Test orders can be used to integrate 1-click purchase (orders with previous order reference).
  • Test orders will be subject to the fraud process, so it is not unusual that they are flagged as 'ApproveStatus = Waiting'. They will be approved automatically in anywhere between a few seconds and a couple of minutes.
  • Since the PaymentDetails node is identical to the one used by the credit card and 2Pay.js token payment methods, once the integration step is done, switching to production is easy, just switch the payment method type.  

Integration test cases

Using the test credit cards available here, follow the next steps:

  1. Build a request with all the relevant information in order to place a new order. Make sure that when the order is sent in the API the response contains an order object (order was placed successfully)
  2. Make sure that you handle the redirect to the 3rd party site.
  3. If you have any additional webhook integrations, make sure that the webhooks are correctly configured and that the notifications are received and processed successfully. 

 

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo