2checkout

2Checkout 2pay.js and token in test mode?


Is there a test mode for 2pay.js? I'm trying to build an integration and getting an error that my transaction is forbidden, which leads me to believe I unfortunately need to wait for them to review a SAQ-A questionnaire to give me test access... But perhaps there's a magic incantation I'm just missing.

We have an account in demo mode.

{
  "error_code": "FORBIDDEN",
  "message": "You need to contact support in order to have this feature enabled"
}

Here is the request we are submitting:

curl --location --request POST 'https://api.avangate.com/rest/6.0/orders/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Avangate-Authentication: code="xxx" date="2020-03-24 23:52:45" hash="yyy"' \
--data-raw '{
"BillingDetails": {
"FirstName": "Joe",
"LastName": "Sullivan",
"Address1": "123 Easy St",
"City": "Anywhere",
"State": "GA",
"Zip": "70403",
"CountryCode": "US",
"Email": "somebody@gmail.com"
},
"Currency": "usd",
"ExternalReference": "REST_API_AVANGTE",
"Items": [
{
"Code": "xxx",
"Quantity": "1"
}
],
"Language": "en",
"PaymentDetails": {
"Currency": "USD",
"PaymentMethod": {
"EesToken": "190f2d9c-0bbc-4ad0-a902-770adb8e7f90"
},
"Type": "EES_TOKEN_PAYMENT"
}
}'

They are telling me that I have to use the TEST type, but that results in an error about the PaymentMethod being empty:

{
    "error_code": "ORDER_PAYMENT_METHOD_INVALID",
    "message": "The payment method [] is not supported."
}

I'm pretty confident that the TEST type only has to do with using actual card data in the PaymentMethod just like you would with the CC type.

Anyone know if there's a way to test token payments with 2pay.js?


Solution

  • As of 4/5/2020 there is no test mode for the 2pay.js / EES_TOKEN_PAYMENT.

    Unfortunately this means you cannot actually test any code you write to interact with this method, because you end up having to send the entire BillingDetails as well as a complete PaymentDetails object, with card holder data (CHD), and a fairly different rest of the JSON. At that point you've not done anything useful with 2pay.js itself, and you are just implementing the full POST order creation process per: https://app.swaggerhub.com/apis-docs/2Checkout-API/api-rest_documentation/6.0#/Order/post_orders_

    So, this is a big mess and hopefully they'll come out with a test mode soon.