Reference
API reference
All endpoints of the GTRADE API v1 on one page. Base URL https://api.gtradegateway.io.
#Conventions
- Base URL:
https://api.gtradegateway.io. All endpoints are under/v1. - Authentication:
Authorization: Bearer <your API key>(orX-API-Key). See Authentication. - Format: JSON request and response bodies in UTF-8. Send
Content-Type: application/jsonwith a body. Request bodies are limited to 64 KB. - Amounts: JSON numbers in USD. Timestamps: ISO-8601 in UTC.
- Errors: a JSON
errorobject withtype,code,messageandrequest_id. See Errors.
#Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /v1/health | Service health. No authentication. |
| POST | /v1/payments | Create a payment. |
| GET | /v1/payments/{id} | Retrieve a payment. |
| GET | /v1/payments | List payments (limit, status, starting_after). |
| POST | /v1/webhooks | Register a webhook endpoint. |
| GET | /v1/webhooks | List webhook endpoints. |
| DELETE | /v1/webhooks/{id} | Delete a webhook endpoint. |
| POST | /v1/webhooks/{id}/test | Send a test event. |
#Response headers
| Header | Meaning |
|---|---|
X-Request-Id | Unique id of the request (also request_id in error bodies). Quote it when you contact support. |
X-RateLimit-Limit, X-RateLimit-Remaining | Your per-key request budget. See Rate limits. |
Retry-After | Seconds to wait, on 429 responses. |
Idempotent-Replayed: true | POST /v1/payments returned an earlier result for the same idempotency key. |
Cache-Control: no-store | Responses must not be cached. |
#Objects
#Payment
See the Payment object. Statuses: open, pending, partially_paid, paid, cancelled (details).
#List
{ "object": "list", "data": [ ... ], "has_more": false }has_more is only returned by GET /v1/payments.
#Webhook endpoint
| Field | Type | Description |
|---|---|---|
id | string | wh_… |
object | string | "webhook_endpoint" |
url | string | Your HTTPS URL. |
created_at | string | ISO-8601 UTC. |
#Webhook delivery
Returned by POST /v1/webhooks/{id}/test.
| Field | Type | Description |
|---|---|---|
id | string | dlv_…, also sent as the X-Gtrade-Delivery header. |
object | string | "webhook_delivery" |
webhook_id | string | The endpoint. |
event_id | string | evt_… |
event_type | string | payment.test |
status | string | succeeded, or pending if the first attempt failed and a retry is scheduled. |
response_status | number or null | HTTP status your endpoint returned, null on a connection error. |
#Event
See Event payload.
#Health check
curl -i https://api.gtradegateway.io/v1/healthHTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-Id: req_9287ace0f6037aec
Cache-Control: no-store
{"status":"ok"}