Checkout
Two ways for your customer to reach Kina Bank's card page. In both, card details never touch your server or CSHPay.
| Hosted checkout | Drop-in checkout | |
|---|---|---|
| Where the customer is | A CSHPay page showing your business name | Your own page |
| Work for you | Redirect to one URL | Copy one HTML page and add one server route |
| Best for | Getting started; simple sites | A checkout that looks entirely like your own |
Hosted checkout
Create the payment, then redirect the customer to the checkoutUrl in the response. That is all.
The page shows your business name and colour, which the workspace owner sets in the dashboard under Kina Bank. Add ?mode=redirect to the URL to send the customer to Kina Bank's full hosted page instead of the embedded card form.
Drop-in checkout
The customer stays on your page. Three parts:
- Your server creates the payment as usual and renders your checkout page with the payment's id.
- When the customer clicks Pay, your page calls a route on your server, which calls CSHPay for the signed Kina Bank form fields:Your server calls
curl -X POST https://cshpay.cksolutionshub.com/api/v1/payments/{id}/kina-fields \ -H "Authorization: Bearer cpk_test_..."Response{ "paymentId": "7b0e3c0a-…", "mode": "test", "action": "https://test-ipg.kinabank.com.pg/cgi-bin/cgi_link", "method": "POST", "fields": { "TERMINAL": "…", "AMOUNT": "968.62", "ORDER": "…", "P_SIGN": "…", "…": "…" }, "kinaScriptUrl": "https://test-ipg.kinabank.com.pg/kina/js/kbl-ec.js", "kinaCssUrl": "https://test-ipg.kinabank.com.pg/kina/css/kbl-ec.css", "fieldsExpireAt": "2026-11-18T01:55:00.000Z" } - Your page puts
fieldsinto a form and posts it toaction, inside Kina Bank's embedded frame.
The complete page, with its HTML, CSS and script, is in Libraries and samples and under Integrate in the dashboard. Copy it and fill in the four values at the top of its script.
fieldsExpireAt).Send { "style": "redirect" } as the request body if your page redirects the customer to Kina Bank's full page instead of using the embedded frame.
When the customer finishes
CSHPay verifies Kina Bank's result and then sends the customer to your returnUrl with three values added:
https://your-site.com/thanks?payment_id=7b0e3c0a-…&reference=ORDER-14&status=succeeded
In drop-in checkout the customer is inside Kina Bank's frame at that moment, so CSHPay also posts a message to your page, which the sample page uses to move on:
{ "source": "cshpay", "type": "payment.result", "paymentId": "…", "status": "succeeded", "returnUrl": "…" }origin, and fulfil the order only from the webhook or the API.What can happen
| Outcome | Payment status | What to do |
|---|---|---|
| Kina Bank approves | succeeded | Fulfil the order when the webhook arrives |
| The card is declined | failed | Create a new payment if the customer wants to try again |
| A temporary gateway fault | pending | The customer is offered "Try again" on the same payment |
| The customer leaves without paying | pending, then expired | Nothing. A payment.expired event follows |
