Checkout

Two ways for your customer to reach Kina Bank's card page. In both, card details never touch your server or CSHPay.

Hosted checkoutDrop-in checkout
Where the customer isA CSHPay page showing your business nameYour own page
Work for youRedirect to one URLCopy one HTML page and add one server route
Best forGetting started; simple sitesA 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:

  1. Your server creates the payment as usual and renders your checkout page with the payment's id.
  2. 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"
    }
  3. Your page puts fields into a form and posts it to action, 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.

Ask for the fields when the customer clicks, not when the page loads. Kina Bank rejects fields signed more than an hour earlier (see 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.

Your Kina Bank secret key never leaves CSHPay, and the fields contain only a signature, not the key. Do not change any field before posting it: the signature covers them, and Kina Bank will reject the payment.

When the customer finishes

CSHPay verifies Kina Bank's result and then sends the customer to your returnUrl with three values added:

Example
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:

window message
{ "source": "cshpay", "type": "payment.result", "paymentId": "…", "status": "succeeded", "returnUrl": "…" }
These are for moving the customer along, not for deciding whether they paid. Check the message's origin, and fulfil the order only from the webhook or the API.

What can happen

OutcomePayment statusWhat to do
Kina Bank approvessucceededFulfil the order when the webhook arrives
The card is declinedfailedCreate a new payment if the customer wants to try again
A temporary gateway faultpendingThe customer is offered "Try again" on the same payment
The customer leaves without payingpending, then expiredNothing. A payment.expired event follows