Skip to main content

Payments

This is where the core payment stuff happens -- starting a payment, handling 3D Secure, capturing money, reversing payments, and changing authorised amounts.

If you're using the Sessions flow, the Drop-in handles the payment and 3DS steps for you. You'll only need the post-authorisation bits (capture, reversal, amount update) if they apply to your setup.

All these endpoints mirror their Adyen equivalents. The request and response shapes are the same, so the Adyen docs work as a companion to these.


Start a payment

Kicks off a payment. The paymentMethod object comes straight from the Adyen Component's onSubmit callback -- just pass it through as-is.

This mirrors Adyen's /payments endpoint.

Request

POST /v1/ecom/{siteId}/payments

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicate payments. See Best Practices.

Body:

FieldTypeNeeded?What it is
amountobjectYesHow much to charge.
amount.valueintegerYesAmount in minor units (so 1000 for 10.00).
amount.currencystringYesThree-letter currency code.
paymentMethodobjectYesThe payment method data from the Adyen Component's onSubmit callback. Just pass it through exactly as you got it.
returnUrlstring (URI)YesWhere to send the customer after 3DS or a redirect.
referencestringNoYour own reference for this payment (up to 80 characters).

Things we handle for you

  • Shopper interaction: Automatically set to Ecommerce.
  • Country code: Set to your merchant's registered country.
  • Payment splits: Sorted out behind the scenes.

Response

You'll get back an Adyen PaymentResponse. Here are the key bits:

FieldTypeWhat it is
resultCodestringWhat happened: Authorised, Refused, Pending, RedirectShopper, ChallengeShopper, etc.
pspReferencestringAdyen's unique reference for this payment. You'll need this for captures, reversals, and amount changes.
actionobjectIf the customer needs to do something extra (like 3DS), this tells you what. Pass it to the Adyen Component.

What the result codes mean:

ResultWhat happenedWhat to do next
AuthorisedThe payment went through.You're done. If you're using manual capture, capture it when you're ready.
RefusedThe payment was turned down.Let the customer know and let them try again.
PendingIt's still being processed.Wait for a webhook with the final result.
RedirectShopperThe customer needs to be redirected (like for 3DS or iDEAL).Pass the action to the Adyen Component.
ChallengeShopperA 3DS challenge is needed.Pass the action to the Adyen Component.

Example

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payments \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"value": 2500,
"currency": "GBP"
},
"paymentMethod": {
"type": "scheme",
"encryptedCardNumber": "adyenjs_...",
"encryptedExpiryMonth": "adyenjs_...",
"encryptedExpiryYear": "adyenjs_...",
"encryptedSecurityCode": "adyenjs_..."
},
"returnUrl": "https://your-shop.com/checkout/result",
"reference": "order-12345"
}'

The paymentMethod object above is just for illustration. In practice, you get it from the Adyen Component's onSubmit callback and pass it straight through.

Dealing with 3DS and redirects

If the response has an action object, the customer needs to do something extra (usually 3D Secure). Pass the action to the Adyen Component:

if (result.action) {
component.handleAction(result.action);
}

When the customer finishes, the Component fires its onAdditionalDetails callback. Take those details and send them to the payment details endpoint below.

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
404yp_3004We can't find that site, or it's not an ecommerce site
404yp_3005We can't find the merchant
422yp_5003Your merchant account isn't set up for ECOM yet
500yp_4006Something went wrong starting the payment

Submit payment details

Sends the extra details needed to finish a payment -- usually after a 3D Secure challenge or redirect. You call this when the Adyen Component fires its onAdditionalDetails callback.

This mirrors Adyen's /payments/details endpoint.

Request

POST /v1/ecom/{siteId}/payments/details

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID (needed in the path, though the payment is identified by the details payload)

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicates.

Body:

FieldTypeNeeded?What it is
detailsobjectYesThe details from the Adyen Component's onAdditionalDetails callback. Pass it through as-is.
paymentDatastringNoPayment data string, if the Component gave you one.

Response

Same shape as the start a payment response.

Example

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payments/details \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"details": {
"threeDSResult": "eyJ0cmFuc1N0YXR1cyI6IlkifQ=="
}
}'

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
500yp_4004Something went wrong submitting the details

Capture a payment

Takes the money from an authorised payment. You only need this if you're using manual capture -- if you're on auto-capture, payments are captured the moment they're authorised and you don't need to do anything.

This mirrors Adyen's /payments/{pspReference}/captures endpoint.

Auto vs manual capture

ModeWhat happensDo you need this endpoint?
Auto-captureThe money is taken as soon as the payment is authorised.No.
Manual captureThe payment is authorised but the money isn't taken yet. You decide when to capture.Yes -- call this when you're ready (like when you ship the order).

Request

POST /v1/ecom/{siteId}/payments/{pspReference}/captures

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID
pspReferencestringThe pspReference from the original payment

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicate captures.

Body:

FieldTypeNeeded?What it is
amountobjectYesHow much to capture.
amount.valueintegerYesAmount in minor units. Can be less than or equal to the original authorisation.
amount.currencystringYesThree-letter currency code.
referencestringNoYour reference for this capture (up to 80 characters).

Response

An Adyen PaymentCaptureResponse:

FieldTypeWhat it is
pspReferencestringAdyen's reference for this capture.
statusstringThe capture status, like received.

Example

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payments/ORIGINAL_PSP_REF/captures \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"value": 2500,
"currency": "GBP"
},
"reference": "capture-order-12345"
}'

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
404yp_3004We can't find that site, or it's not an ecommerce site
404yp_3005We can't find the merchant
500yp_4003Something went wrong capturing the payment

Reverse a payment

Cancels or refunds a payment. You don't need to work out which one -- the API figures it out for you. If the payment hasn't been captured yet, it cancels it. If it has, it refunds it.

This mirrors Adyen's /payments/{pspReference}/reversals endpoint.

Request

POST /v1/ecom/{siteId}/payments/{pspReference}/reversals

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID
pspReferencestringThe pspReference from the original payment

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicate reversals.

Body:

FieldTypeNeeded?What it is
referencestringNoYour reference for this reversal (up to 80 characters).

Response

An Adyen PaymentReversalResponse:

FieldTypeWhat it is
pspReferencestringAdyen's reference for this reversal.
statusstringThe reversal status, like received.

Example

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payments/ORIGINAL_PSP_REF/reversals \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference": "reversal-order-12345"
}'

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
404yp_3004We can't find that site, or it's not an ecommerce site
404yp_3005We can't find the merchant
500yp_4005Something went wrong reversing the payment

Update authorised amount

Changes how much is authorised on a payment before it's captured. This is useful when the final amount might be different from the original -- like hotel stays, car rentals, or when someone changes their order.

This mirrors Adyen's /payments/{pspReference}/amountUpdates endpoint.

Request

POST /v1/ecom/{siteId}/payments/{pspReference}/amount-updates

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID
pspReferencestringThe pspReference from the original payment

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicate updates.

Body:

FieldTypeNeeded?What it is
pspReferencestringYesThe pspReference of the original payment.
amountobjectYesThe new amount.
amount.valueintegerYesNew amount in minor units.
amount.currencystringYesThree-letter currency code.
referencestringNoYour reference for this update (up to 80 characters).

Response

An Adyen PaymentAmountUpdateResponse:

FieldTypeWhat it is
pspReferencestringAdyen's reference for this update.
statusstringThe update status, like received.

Example

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payments/ORIGINAL_PSP_REF/amount-updates \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pspReference": "ORIGINAL_PSP_REF",
"amount": {
"value": 3500,
"currency": "GBP"
},
"reference": "amount-update-order-12345"
}'

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
404yp_3004We can't find that site, or it's not an ecommerce site
404yp_3005We can't find the merchant
500yp_4007Something went wrong updating the amount