Skip to content

Developers

Yeri Online Payments API

Take card payments on your own website with Yeri. Your server creates a payment, the customer pays on Yeri's hosted payment page, and your server confirms the result.

Base URL
https://pay.yeripay.com
Format
All requests and responses are JSON
Amounts
Integers in the smallest currency unit (qəpik): 1250 = 12.50 AZN
Currency
AZN

How it works

  1. Your server → Yeri

    Create a payment

    Your server creates a payment with your secret API key and gets back a checkout_url.

  2. Customer → pay.yeripay.com

    Redirect the customer

    You redirect the customer to checkout_url (Yeri's hosted payment page, pay.yeripay.com). The customer enters the card, CVV and passes 3-D Secure there.

  3. pay.yeripay.com → your site

    The customer comes back

    The customer comes back to your return_url.

  4. Yeri ⇄ your server

    Confirm on your server

    You confirm the result on your server: a signed webhook (payment_intent.succeeded) and/or GET /v1/payment_intents/{id}.

Card data never touches your website, so your PCI scope stays minimal (SAQ A).
Never trust the redirect alone — it can be faked or never happen.

API keys

The business owner creates keys at admin.yeripay.com → Online payments → API keys. A key is shown once; store it in your server's secret store, never in browser or mobile code.

sk_live_…liverealreal cards
sk_test_…testnone (simulation)only the test cards below

Test and live are separate worlds: a test key never sees live payments, saved cards or webhook endpoints (and the other way round). Responses carry "livemode": true|false.

Send the key in the Authorization header of every request:

HTTP
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A revoked or wrong key answers 401 {"error": "invalid_api_key"}.

Create a payment

From your server, send POST /v1/payment_intents:

cURL
curl https://pay.yeripay.com/v1/payment_intents \
  -H "Authorization: Bearer $YERI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042" \
  -d '{"amount_minor": 1250, "currency": "AZN", "description": "Order #1042",
       "return_url": "https://shop.example.com/orders/1042", "locale": "az"}'

Request fields

modepayment (default) | setupsetup = save a card without charging (needs customer_ref)
amount_minorintegerrequired for payment, 1 … 10 000 000
currencyAZN—
descriptionstring ≤ 200shown on the payment page
customer_refstring ≤ 64, [A-Za-z0-9_.:-]your customer id — enables saved cards
return_urlhttps://… ≤ 500"Back to shop" button after the payment
localeaz | en | rupayment page language

Response

Response 201 — a payment intent:

JSON
{
  "id": "pi_8KfT2c1x0aQpZ3mL",
  "object": "payment_intent",
  "livemode": true,
  "mode": "payment",
  "status": "requires_payment_method",
  "amount_minor": 1250,
  "currency": "AZN",
  "description": "Order #1042",
  "customer_ref": null,
  "client_secret": "cs_…",
  "checkout_url": "https://pay.yeripay.com/?pi=pi_8KfT2c1x0aQpZ3mL#cs=cs_…",
  "card": null,
  "saved_card_id": null,
  "approval_code": null,
  "rrn": null,
  "refunded_minor": 0,
  "last_error": null,
  "created_at": 1763300000
}

Redirect the customer to checkout_url as is. The link is valid for 30 minutes; the customer has 3 attempts. Treat client_secret like a password (it opens this payment's page); don't log it.

Idempotency

Send Idempotency-Key (≤ 128 chars, e.g. your order id). Repeating the same request with the same key returns the same intent instead of creating a second one; the same key with a different body answers 409 idempotency_key_mismatch.

Statuses

requires_payment_methodwaiting for the card (or the last attempt was declined and attempts remain)
requires_actionthe customer is on the bank's 3-D Secure screen
processingthe bank is still deciding — wait for the webhook or poll
succeededpaid (or, for setup, the card is saved) — ship the order
failedno more attempts or the link expired (last_error says why)
partially_refundedrefundedmoney (partly) returned
reversedauthorization cancelled before settlement

Check, refund, reversal

Check a payment

cURL
curl https://pay.yeripay.com/v1/payment_intents/pi_8KfT2c1x0aQpZ3mL \
  -H "Authorization: Bearer $YERI_SECRET_KEY"

Refund and reversal

cURL
# partial refund (omit the body for a full refund of what is left)
curl -X POST https://pay.yeripay.com/v1/payment_intents/pi_8KfT2c1x0aQpZ3mL/refund \
  -H "Authorization: Bearer $YERI_SECRET_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: refund-1042-1" -d '{"amount_minor": 300}'

# reversal (same day, before settlement)
curl -X POST https://pay.yeripay.com/v1/payment_intents/pi_8KfT2c1x0aQpZ3mL/reverse \
  -H "Authorization: Bearer $YERI_SECRET_KEY"
502 refund_rejected / reverse_rejected = the bank said no and no money moved; you may retry.

Saved cards

Pass customer_ref and the payment page offers "Remember this card". Next time the customer pays with one tap (CVV is not stored anywhere — the bank confirms the customer instead). To save a card without charging, create an intent with "mode": "setup".

List a customer's saved cards, or delete one:

cURL
curl https://pay.yeripay.com/v1/customers/cust_77/cards -H "Authorization: Bearer $YERI_SECRET_KEY"
curl -X DELETE https://pay.yeripay.com/v1/customers/cust_77/cards/card_… -H "Authorization: Bearer $YERI_SECRET_KEY"

A card has id, brand, last4, exp_month, exp_year. Yeri deletes cards that expired or were not used for 24 months.

Webhooks

Register an HTTPS endpoint once; Yeri POSTs an event to it when a payment reaches a final state.

cURL
curl https://pay.yeripay.com/v1/webhook_endpoints \
  -H "Authorization: Bearer $YERI_SECRET_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://shop.example.com/yeri/webhook", "enabled_events": ["*"]}'
The answer contains "secret": "whsec_…" — shown only once, store it next to your API key. Up to 5 endpoints per mode. GET /v1/webhook_endpoints lists them, DELETE /v1/webhook_endpoints/{id} removes one. Test-key endpoints receive only test events.

Events

payment_intent.succeededpaid / card saved
payment_intent.failedno attempts left or expired
payment_intent.partially_refundedeach partial refund
payment_intent.refundedfully refunded
payment_intent.reversedreversed

Event payload

JSON
{
  "id": "evt_Xq3…",
  "object": "event",
  "type": "payment_intent.succeeded",
  "created": 1763300042,
  "livemode": true,
  "data": { "object": { "id": "pi_8KfT2c1x0aQpZ3mL", "object": "payment_intent", "status": "succeeded", "…": "…" } }
}

data.object is the payment intent without client_secret and checkout_url.

Delivery

Answer any 2xx within 10 seconds (do the slow work afterwards). Anything else — or a timeout — is retried after 1 min, 5 min, 30 min, 1 h, 3 h, 6 h, 12 h, then daily, for about 4 days. Redirects are not followed.

Delivery is at least once: the same event can arrive twice — use id to ignore duplicates. Events can arrive out of order; trust the status inside, or re-read the intent.

Verify the signature

Every request has Yeri-Signature: t=<unix time>,v1=<hex> and Yeri-Event-Id. v1 = HMAC-SHA256(secret, "<t>.<raw body>"). Use the raw body bytes (not re-encoded JSON), compare in constant time, and reject t older than 5 minutes.

import crypto from "node:crypto";
app.post("/yeri/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const header = req.get("Yeri-Signature") || "";
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const expected = crypto.createHmac("sha256", process.env.YERI_WEBHOOK_SECRET)
    .update(`${parts.t}.`).update(req.body).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300;
  const ok = fresh && parts.v1 && parts.v1.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
  if (!ok) return res.sendStatus(400);
  const event = JSON.parse(req.body);
  if (event.type === "payment_intent.succeeded") { /* mark order paid (once per event.id) */ }
  res.sendStatus(200);
});

Missed events

GET /v1/events?limit=20&starting_after=evt_…&payment_intent=pi_… lists the last 30 days (newest first, has_more for paging) in the same format, so you can catch up after downtime.

Test mode

Use an sk_test_… key. Nothing is charged; only these cards work (any future expiry date, any 3-digit CVV):

4242 4242 4242 42425555 5555 5555 4444success
4000 0000 0000 32203-D Secure screen — code 123456 succeeds, anything else fails
4000 0000 0000 0002declined (do_not_honor)
4000 0000 0000 9995declined (insufficient_funds)
4000 0000 0000 0101wrong CVV (incorrect_cvc)

The payment page shows a "Test mode" banner. Real card numbers are refused in test mode.

Errors

Errors are {"error": "<code>"} with an HTTP status; validation errors add "fields": [...].

400invalid_numberinvalid_expiryinvalid_cvcunsupported_brandcard_or_saved_card_required
401invalid_api_key
403merchant_disabledonline payments switched off for the business
404intent_not_foundcard_not_foundendpoint_not_found
409idempotency_key_mismatchintent_not_refundableintent_not_reversibletoo_many_endpoints
410intent_expired
422invalid_requestamount_requiredcustomer_ref_requiredinvalid_webhook_urlinvalid_event_type
429too_many_attempts
502acquirer_unavailablerefund_rejectedreverse_rejectedretry later
503directory_unavailabletemporary, retry with the same Idempotency-Key

A declined card is not an error: the intent comes back with status and last_error (e.g. do_not_honor).

Go-live checklist

  • The secret key and the webhook secret live only on your server.
  • Order is marked paid only after a verified payment_intent.succeeded webhook (or a server-side GET).
  • Webhook handler is idempotent by event.id and answers 2xx fast.
  • Idempotency-Key = your order id on create and refund.
  • You tested success, decline, 3-D Secure and refund with an sk_test_ key.

Ready to start?

Create a test key, try the integration with the test cards, then switch to a live key.