REST & JSON basics
If you’ve worked with a REST API before, skip this — head to Introduction. If not, here’s the vocabulary the rest of this reference uses.
The Pesepay API is a REST API: you interact with it by sending HTTP requests to URLs (endpoints), and it follows HTTP conventions for methods, headers and status codes. Every Pesepay endpoint is one of two methods:
| Method | Meaning | Pesepay endpoints |
|---|---|---|
GET | Read something, changing nothing | Check Payment Status, Get Active Currencies, Get Payment Methods by Currency |
POST | Create or submit something | Initiate Transaction, Make Payment |
Requests are made over HTTPS (HTTP encrypted with TLS) — plain http://
is rejected. A request has four parts: the method, the endpoint URL,
headers (Pesepay uses authorization and content-type), and a body.
A response has three: a status code, headers, and a body.
The status code tells you what happened: 2xx succeeded, 4xx means your
request was wrong (bad field, missing auth), 5xx means the server failed.
The full table is on the Errors page.
Request and response bodies are JSON — though with Pesepay the meaningful JSON is encrypted inside an envelope. JSON has a small set of types, and the field tables in this reference use these names:
| Type | Example |
|---|---|
| string | "Order #1042" |
| number | 10.50 |
| boolean | true / false |
| null | null — no value |
| object | { "amount": 10, "currencyCode": "USD" } — key/value pairs in braces |
| array | ["USD", "ZiG"] — an ordered list in brackets |