API reference
Every endpoint, field and error.
Basics
| Base URL | https://cshpay.cksolutionshub.com/api/v1 |
| Authentication | Authorization: Bearer cpk_test_… or cpk_live_… |
| Format | JSON in, JSON out. HTTPS only. |
| Modes | A key belongs to one workspace and one mode, and sees only that mode's data. |
| Rate limit | Per key, by plan (60 a minute to start). Over the limit: 429 with Retry-After. |
| Browsers | No CORS headers are sent. Call the API from your server only. |
Key permissions
| Scope | Allows |
|---|---|
payments:write | Create payments; get signed Kina fields |
payments:read | Read and list payments |
refunds:write | Refund payments |
webhooks:write | Create, list and remove webhook endpoints |
Create a payment
POST /payments · scope payments:write
| Field | Required | Notes |
|---|---|---|
amount | Yes | A number above 0 with at most 2 decimals, up to 50,000.00 |
reference | Yes | Your own id for the order. 1–64 characters: letters, digits, spaces and - _ / . # : |
returnUrl | Yes | Where the customer is sent afterwards. Must be https in live mode |
currency | No | PGK only (the default) |
description | No | Shown at checkout. Up to 200 characters |
customer | No | { "email", "name" } |
expiresIn | No | Seconds the payment can be paid: 300 to 604800. Default 86400 (one day) |
metadata | No | Up to 20 string keys, returned unchanged. The key billing is reserved |
Send an Idempotency-Key header (up to 255 characters). The first request with a key creates the payment and returns 201; a repeat returns the same payment with 200. Reusing a key for a different amount, currency or reference returns 409 IDEMPOTENCY_MISMATCH.
The payment object
{
"id": "7b0e3c0a-6f0b-4b63-9d0c-2f8f7a3a1e11",
"object": "payment",
"mode": "test",
"reference": "ORDER-14",
"amount": "968.62",
"currency": "PGK",
"description": "Order #14",
"customer": { "email": "mary@example.com", "name": "Mary Kila" },
"status": "succeeded",
"checkoutUrl": null,
"returnUrl": "https://your-site.com/thanks",
"metadata": {},
"gateway": {
"order": "261118100042",
"approvalCode": "123456",
"authorizedAmount": "968.62",
"rrn": "…",
"reference": "…",
"responseCode": "00",
"message": "Approved"
},
"paidAt": "2026-11-18T00:14:09.101Z",
"refundedAt": null,
"expiresAt": "2026-11-19T00:00:00.000Z",
"createdAt": "2026-11-18T00:00:00.000Z"
}| Status | Meaning |
|---|---|
pending | Not paid yet. checkoutUrl is set |
succeeded | Paid. Kina Bank's signed result has been verified |
failed | Declined or failed. Final; create a new payment to try again |
expired | Not paid before it expired |
refund_pending | A refund was sent to Kina Bank and its outcome is not confirmed yet |
refunded | Reversed in full |
refund_failed | Kina Bank declined the reversal. The payment remains paid |
amount is what you asked for. gateway.authorizedAmount is what Kina Bank authorized, which can be higher if the acquirer adds a fee.Read payments
GET /payments/{id} · scope payments:read. The authoritative state of one payment.
GET /payments?reference=ORDER-14&limit=20 · scope payments:read. Newest first; limit up to 100.
{ "object": "list", "data": [ { "id": "…", "object": "payment", "…": "…" } ] }Signed Kina fields (drop-in checkout)
POST /payments/{id}/kina-fields · scope payments:write. Optional body { "style": "iframe" | "redirect" }. Returns the form fields to post to Kina Bank. See Checkout.
Refund a payment
POST /payments/{id}/refund · scope refunds:write. Reverses a succeeded payment in full. No body.
| HTTP | Status in the response | Meaning |
|---|---|---|
| 200 | refunded | Kina Bank reversed it |
| 200 | refund_failed | Kina Bank declined the reversal |
| 202 | refund_pending | Sent, outcome not confirmed. A webhook follows when it is known |
Partial refunds are not supported. A key may make at most 30 refunds an hour.
Webhook endpoints
POST /webhook-endpoints · scope webhooks:write
{ "url": "https://your-site.com/webhooks/cshpay", "events": ["*"], "description": "Production" }The response includes secret (whsec_…), shown this once. events is ["*"] or a list of event types. GET /webhook-endpoints lists active endpoints; DELETE /webhook-endpoints/{id} stops deliveries to one.
Errors
{ "error": { "code": "VALIDATION", "message": "The request is not valid", "fields": { "amount": ["amount must be greater than 0"] } } }| Code | HTTP | Meaning |
|---|---|---|
UNAUTHORIZED | 401 | Missing, malformed or revoked key |
BILLING_OVERDUE | 402 | An invoice is overdue; live requests are refused until it is paid |
FORBIDDEN | 403 | The key lacks the permission, or the request was not HTTPS |
ACCOUNT_SUSPENDED | 403 | The workspace is suspended |
NOT_FOUND | 404 | No such object in this workspace and mode |
IDEMPOTENCY_MISMATCH | 409 | That Idempotency-Key was used for a different payment |
NOT_CONFIGURED | 409 | Live mode is not enabled for the workspace |
NOT_PAYABLE | 409 | The payment is already paid, failed or expired |
NOT_REFUNDABLE | 409 | The payment is not in a refundable state |
VALIDATION | 422 | Invalid request; fields says which |
RATE_LIMITED | 429 | Too many requests; see Retry-After |
INTERNAL | 500 | Unexpected error. Safe to retry with the same Idempotency-Key |
