Tranzak Docs
tranzak.co Dashboard
Docs  /  Accept payments

Tranzak Pay (QR code)

Accept card payments by QR code with Tranzak Pay: create a payment, show the QR code, follow its status, receive webhooks and refund the customer's card.

Tranzak Pay lets your customers pay by scanning a QR code with the Tranzak Pay app. The customer has saved a Visa or Mastercard in the app after an identity check, so they confirm with their PIN and the card is charged. You never handle card data.

How it works

  1. Your server creates a payment and receives a QR payload.
  2. You display the QR code (on a POS screen, a checkout page or a printed receipt).
  3. The customer scans it, checks the amount and confirms with their PIN. If their bank asks for 3D Secure, the app handles it.
  4. Tranzak sends you the payment.success webhook. You can also poll the payment.

A QR code is valid for 5 minutes by default (1 to 15 minutes with expires_in). A customer has 3 attempts per QR code, so a declined card can be replaced by another one.

Before you start

  • Tranzak Pay uses the same website and API keys as the rest of the API (see Authentication).
  • Choose who pays the fee in your dashboard before creating payments: you or the customer.
  • Test mode (tk_test_ keys) is free and needs no approval. Live mode (tk_live_ keys) needs approval of your account: request it from your dashboard.
  • Amounts are in USD or HTG. The card is always charged in USD: an HTG price is converted at the rate fixed when you create the payment (see Currencies and exchange rate).
  • Each payment must be between 5 USD and 1,000 USD (or the HTG equivalent).

Fees

One fee applies per payment: 6 % of the price, with a minimum of 1.25 USD. It is shown to the customer before they pay.

  • If the customer pays the fee, it is added to the price on the customer's side. You receive the full price.
  • If you pay the fee, the customer pays the price and the fee is deducted from what you receive.

Call the quote endpoint to see exact amounts without creating a payment.

Create a payment

POST/api/gateway/v1/tranzak-pay/payments
curl https://api.tranzak.co/api/gateway/v1/tranzak-pay/payments \
  -H "X-Api-Key: $TRANZAK_API_KEY" \
  -H "Idempotency-Key: order-4821-create" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25.00,
    "currency": "USD",
    "reference": "ORDER-4821",
    "description": "Order #4821",
    "expires_in": 600
  }'
const res = await fetch('https://api.tranzak.co/api/gateway/v1/tranzak-pay/payments', {
  method: 'POST',
  headers: {
    'X-Api-Key': process.env.TRANZAK_API_KEY,
    'Idempotency-Key': 'order-4821-create',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ amount: 25.0, currency: 'USD', reference: 'ORDER-4821', description: 'Order #4821', expires_in: 600 }),
});
const { data } = await res.json();
// Encode data.qr.payload as a QR code and display it.
Field Required Description
amount Yes The price, greater than 0.
currency Yes USD or HTG.
reference No Your own reference (up to 255 characters).
description No Shown to the customer (up to 500 characters).
metadata No Your own data, returned as you sent it.
customer_name No Name of your customer, for your records.
expires_in No Seconds before the QR code expires, from 60 to 900.

Send an Idempotency-Key header (8 to 100 characters) so a retry never creates two payments. Replaying the same key with the same body returns the original payment with Idempotent-Replayed: true. Reusing it with different parameters returns idempotency_key_reused.

The response

{
  "success": true,
  "data": {
    "id": "tzpay_01m7caaa8k2ww0ddkf6czp16b5",
    "transaction_id": "17946365266334",
    "status": "pending",
    "environment": "live",
    "amount": 25.0,
    "currency": "USD",
    "reference": "ORDER-4821",
    "description": "Order #4821",
    "fee": { "payer": "customer", "amount": 1.5, "currency": "USD", "refundable": false },
    "customer_pays": 26.5,
    "merchant_receives": 25.0,
    "card_charge": { "amount": 26.5, "currency": "USD", "exchange_rate": null },
    "refunded_amount": 0,
    "refundable_amount": 0,
    "refunds": [],
    "expires_at": "2026-11-14T01:23:46-05:00",
    "paid_at": null,
    "failure_code": null,
    "created_at": "2026-11-14T01:08:46-05:00",
    "qr": { "payload": "https://api.tranzak.co/tzp/pay/…", "expires_in": 600 }
  }
}
Field Description
status pending, processing, paid, failed, expired or canceled. Branch your logic on this field.
qr.payload The text to encode in the QR code. Present while the payment is pending.
customer_pays What the customer sees, fee included when they pay it.
merchant_receives What is credited to you.
card_charge What is charged to the card, always in USD. exchange_rate is set for HTG prices.
failure_code Why the last attempt failed, for example card_declined. The customer can try again until the QR code expires.

Retrieve or cancel a payment

GET /api/gateway/v1/tranzak-pay/payments/{id} returns the payment object. {id} is the tzpay_… identifier or the transaction_id.

POST /api/gateway/v1/tranzak-pay/payments/{id}/cancel cancels a payment that is still pending. A payment that is paid, processing or already final returns payment_not_cancelable.

Do not rely on polling alone: use the webhooks and treat polling as a safety net.

Get a quote

GET/api/gateway/v1/tranzak-pay/quote?amount=25&currency=USD

Returns the fee, the customer total, your net amount and the USD charge, plus within_limits and limit_error (amount_too_low or amount_too_high). Until you have chosen who pays the fee, both possibilities are returned.

Webhooks

Tranzak Pay uses the standard events, signed like all others (see Verify the signature).

Event When
payment.success The customer paid.
payment.failed The payment failed or the QR code expired without payment. Sent once.
payment.refunded A refund succeeded.

Refund a payment

POST/api/gateway/v1/tranzak-pay/payments/{id}/refund
curl https://api.tranzak.co/api/gateway/v1/tranzak-pay/payments/tzpay_01m7caaa8k2ww0ddkf6czp16b5/refund \
  -H "X-Api-Key: $TRANZAK_API_KEY" \
  -H "Idempotency-Key: refund-4821-1" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 5.00, "reason": "Item returned" }'
Field Required Description
amount No Amount to refund, in the payment's currency. Omit it to refund everything that can still be refunded.
reason No A note for your records (up to 255 characters).

The money goes back to the customer's card.

  • The fee is never refunded. Only the price can be refunded. refundable_amount on the payment shows what is left.
  • You can refund a payment in full or in several partial refunds, up to 30 days after it was paid.
  • Only one refund can be in progress per payment.
  • Your available balance must cover the refund. If you paid the fee, your share of it is also taken into account.
  • For an HTG payment, the customer gets back the USD amount at the rate frozen when the payment was made.

Send an Idempotency-Key on every refund. If a request times out or returns provider_unavailable, retry with the same key: you will get the same refund and never a second one.

{
  "success": true,
  "data": {
    "id": "tzrf_01m7cb0rxdfb5gktcqefg6whe9",
    "status": "succeeded",
    "amount": 5.0,
    "currency": "USD",
    "card_refund": { "amount": 5.0, "currency": "USD" },
    "reason": "Item returned",
    "failure_code": null,
    "created_at": "2026-11-14T01:13:20-05:00",
    "refunded_at": "2026-11-14T01:13:22-05:00",
    "payment": { "id": "tzpay_01m7caaa8k2ww0ddkf6czp16b5", "refunded_amount": 5.0, "refundable_amount": 7.5, "currency": "USD" }
  }
}

GET /api/gateway/v1/tranzak-pay/payments/{id}/refunds lists the refunds of a payment. The customer receives an e-mail for each refund.

Errors

Errors use the standard format: success: false, a stable error code and a message (see Errors and rate limits).

Code HTTP Meaning
validation_error 422 A field is missing or invalid.
fee_payer_not_set 422 Choose who pays the fee in your dashboard first.
payment_method_not_approved 403 Live access is not approved yet. Test mode is always available.
payment_not_found 404 No payment with this identifier on your website.
idempotency_key_reused 422 The key was used with different parameters.
payment_not_cancelable 409 The payment is no longer pending.
payment_not_refundable 409 Only a paid payment can be refunded.
refund_window_expired 422 More than 30 days since the payment.
refund_in_progress 409 Another refund of this payment is still being processed.
amount_exceeds_refundable 422 The amount is above refundable (returned in the response).
amount_too_low 422 The amount is too small to refund, or the payment is already fully refunded.
insufficient_balance 422 Your available balance is short by shortfall.
refund_rejected 422 The card network refused the refund.
provider_unavailable 503 Outcome not confirmed yet (retryable). Retry with the same Idempotency-Key.

Test your integration

Use a tk_test_ key. No real money moves.

  1. Create a payment with your test key.
  2. In the Tranzak Pay app, sign in with the test account that your dashboard creates for you on the Tranzak Pay page, and scan the QR code. A test QR code can only be paid with that account, and a live QR code cannot be paid with it.
  3. Pay with a test card, for example 4242 4242 4242 4242 (any future date, any CVC). Use 4000 0027 6000 3184 to go through 3D Secure and 4000 0000 0000 0341 to see a declined payment.
  4. Check your webhook and refund the payment.