The PetraPay API is a REST API with JSON requests and responses, in the style of Stripe. Use it from your server to create checkouts, track their status and manage payment links.
https://api.petrapay.xyz/v1Authentication
Create a secret key in Dashboard → Developers and send it as a bearer token. Keys start with pp_sk_ and are shown only once.
curl https://api.petrapay.xyz/v1/checkouts \
-H "Authorization: Bearer pp_sk_..."Keep secret keys on your server
Never put a secret key in a browser, a mobile app or a public repository. If one leaks, revoke it in the dashboard; requests using it fail immediately.Errors
Failed requests return a 4xx or 5xx status with an error object. When a specific field is wrong, param names it.
{
"error": {
"type": "invalid_request_error",
"message": "success_url: Must be a full http(s) URL",
"param": "success_url"
}
}| type | When |
|---|---|
| invalid_request_error | Bad parameters (400), an unknown id (404), or an action not allowed in the current state (409). |
| authentication_error | Missing, invalid or revoked API key (401). |
| idempotency_error | An Idempotency-Key reused with different parameters, or still in progress. |
| rate_limit_error | More than 120 requests a minute with one key (429). |
| api_error | Something went wrong on our side (5xx). Safe to retry with the same Idempotency-Key. |
Idempotency
Send an Idempotency-Key header on POST requests; your order id works well. Retrying with the same key and body within 24 hours returns the original response (with Idempotent-Replayed: true) instead of creating a duplicate. Requests that fail don't use up the key.
Pagination
List endpoints return newest first, as { "object": "list", "data": [...], "has_more": true }. Pass limit (1–100, default 10) and starting_after with the last id you received to get the next page.
Amounts
Amounts are decimal strings in the checkout's currency, never floats: "49.99" for USD, "0.25" for ZEC. The minimum is $1.00 or 0.001 ZEC.