Developers

Checkouts

Create a hosted payment page from your server and track its status.

A checkout is a single payment with a hosted page. Create one from your server, send the customer to its url, and fulfil the order when you receive the checkout.paid webhook.

Create a checkout

POST/v1/checkouts

Body

currencystringrequired

USD or ZEC.

titlestringrequired

Shown to the customer. Up to 120 characters.

amountstring

Total as a decimal string. Give this or line_items.

line_itemsarray

Up to 50 of { description, quantity, unit_amount }. The total is computed for you.

descriptionstring

A longer note shown on the checkout.

referencestring

Your own id, such as an order id. Filterable, and included in webhooks.

metadataobject

Up to 20 string key/value pairs, returned as-is.

customerobject

{ name, email }, shown as "Billed to".

success_urlstring

Where to send the customer after paying. {CHECKOUT_ID} is replaced with the checkout's id.

cancel_urlstring

Shown as a "Back to …" link before paying.

expires_ininteger

Seconds until it stops accepting payments: 300 to 604800. Default 86400 (24 hours).

Request

curl https://api.petrapay.xyz/v1/checkouts \
  -H "Authorization: Bearer pp_sk_..." \
  -H "Idempotency-Key: order_1001" \
  -H "Content-Type: application/json" \
  -d '{
    "currency": "USD",
    "amount": "49.99",
    "title": "Order #1001",
    "reference": "order_1001",
    "customer": { "email": "[email protected]" },
    "success_url": "https://shop.example/thanks?checkout={CHECKOUT_ID}",
    "cancel_url": "https://shop.example/cart"
  }'

The checkout object

Response

{
  "id": "G8VN5idaQDX6",
  "object": "checkout",
  "livemode": true,
  "url": "https://petrapay.xyz/pay/G8VN5idaQDX6",
  "status": "open",
  "number": 42,
  "currency": "USD",
  "amount": "49.99",
  "title": "Order #1001",
  "description": null,
  "line_items": [{ "description": "Order #1001", "quantity": 1, "unit_amount": "49.99" }],
  "reference": "order_1001",
  "metadata": { "cart_id": "c_93" },
  "customer": { "name": null, "email": "[email protected]" },
  "success_url": "https://shop.example/thanks?checkout={CHECKOUT_ID}",
  "cancel_url": "https://shop.example/cart",
  "payment_link": null,
  "source": "api",
  "amount_received": null,
  "expires_at": "2026-11-10T09:00:00.000Z",
  "paid_at": null,
  "created_at": "2026-11-09T09:00:00.000Z"
}

statusstring

open, processing, paid, cancelled or expired.

urlstring

The hosted payment page. Send the customer here.

amount_receivedobject | null

Once paid: { zec, usd }, what was delivered to your shielded address.

livemodeboolean

false for test sales from a POS terminal in test mode.

sourcestring

Where it came from: api, dashboard, payment_link or pos.

Retrieve a checkout

GET/v1/checkouts/{id}

Use this to confirm a checkout's status, for example on your success page or when reconciling.

List checkouts

GET/v1/checkouts

Query

statusstring

Only checkouts with this status.

referencestring

Only checkouts with this reference.

limit, starting_afterpagination

Cancel a checkout

POST/v1/checkouts/{id}/cancel

Fails with 409 once a payment is underway or done.

The hosted checkout flow

  1. Create a checkout and redirect

    Your server creates the checkout and sends the customer to its url.

  2. The customer pays

    They pick a token, see the exact quote and pay from their wallet, or pay shielded ZEC directly.

  3. They come back

    After a few seconds on the paid screen, the customer is sent to your success_url.

  4. You fulfil the order

    Do it when the checkout.paid webhook arrives, not on the success page: customers can close the tab before they're redirected.

A payment that was already underway can still settle after a checkout expires or is cancelled; you'll get checkout.paid either way.