Skip to main content

How to do a transaction in Adyen

  1. Creating a transaction in Payhub:
curl --location 'https://api.payhub.cm.com/v1/accounts/{{logical-account-id}}/transactions'
--header 'X-CM-SSO-ACCOUNTGUID: {{your-account-guid}}'
--header 'Content-Type: application/json'
--data-raw '{
"amount": {
"currency": "USD",
"amount": "121"
},
"connectionId": "{{adyen-connection-id-in-payhub}}",
"description": "IPhone 7",

"expiresAtUtc": "2024-12-05T08:39:55.719Z",
"reference": "PRODID00002",
"returnUrlSuccess": "https://www.example.com",
"returnUrlFailure": "https://www.test.com",
"webhook": "https://www.example.com/webhook"
}'

It give the following response:

{
"id": "be463444-486d-4ee6-96da-e406753ced78",
"accountId": "{{your-logical-account-id}}",
"amount": {
"currency": "USD",
"amount": "121.00"
},
"status": "Created",
"type": "Payment",
"reference": "PRODID00002",
"allowedMethods": null,
"providerReference": "PL610FF4C4E02D532F1",
"providerData": {},
"description": "IPhone 7",
"connectionId": "{{your-amazon-connection-id}}",
"relatedTransactionId": null,
"expiresAtUtc": "2024-12-05T08:39:55.719Z",
"additionalData": {},
"redirectUrl": "https://payhub.cm.com/l/qtbBG0J8Sa7eguddr60-n",
"returnUrlSuccess": "https://www.example.com",
"returnUrlFailure": "https://www.test.com",
"webhook": "https://www.example.com/webhook"
}
  1. Once you click on the redirect URL in the response it will take you to the Amazon Payment Service payment window:

Payment window shown after following the transaction redirect URL

only if the transaction is successful, it will redirect to the returnUrlSuccess that you have provided while creating the transaction otherwise it will stay in the same page.

  1. Adyen expires the link after 3 months, if the transaction was created and not proceeded further.

You can find the test cards here: https://docs.adyen.com/development-resources/testing/test-card-numbers/

Use this account to test Adyen connection in production:

https://www.cm.com/en-gb/app/marketplace/05e1ee3f-301d-4648-a165-df012dad4902/payment/f58d5a33-eef2-4b29-a37f-c3bc55bc3cc9