Skip to Content
KingsPay Docs
Charges

Payment Actions

Every charge response includes a payment_action object. This tells your application what to present to the customer so they can complete the payment. The shape varies by payment method, but every action also includes a hosted_url as a ready-made fallback.

"payment_action": {
  "type": "...",
  "hosted_url": "https://pay.example.com/pay/<charge-id>",
  ...
}

Using the hosted URL

The hosted_url is always present regardless of action type. Redirecting your customer to this URL is the simplest integration path — KingsPay renders the correct payment UI for the method automatically. You do not need to handle the action type yourself if you use this approach.

Action types

redirect_to_url

The customer must be redirected to an external URL to complete the payment. This is typically used for e-wallets or bank redirects where the customer must leave your app to complete the payment.

"payment_action": {
  "type": "redirect_to_url",
  "redirect_to_url": {
    "url": "https://..."
  },
  "hosted_url": "https://pay.example.com/pay/<charge-id>"
}
FieldDescription
typeredirect_to_url
redirect_to_url.urlThe external URL to redirect the customer to. Open this in the browser or a webview.
hosted_urlKingsPay-hosted page that handles the redirect for you.

qris_display_qr_code

A QRIS payload is returned for you to render as a QR code in your application. The customer scans it with any QRIS-compatible app.

"payment_action": {
  "type": "qris_display_qr_code",
  "qris_display_qr_code": {
    "data": "00020101021226730021COM.GUDANGVOUCHER..."
  },
  "hosted_url": "https://pay.example.com/pay/<charge-id>"
}
FieldDescription
typeqris_display_qr_code
qris_display_qr_code.dataThe raw QRIS payload string. Pass this to any QR code rendering library to generate the scannable image.
hosted_urlKingsPay-hosted page that displays the QR code for you.

virtual_account_transfer

The customer must transfer funds to a virtual account number. Display the bank name, account number, name, and the exact amount to transfer — and make sure to communicate the expiry time.

"payment_action": {
  "type": "virtual_account_transfer",
  "virtual_account_transfer": {
    "transfer_amount": 20220.00,
    "currency": "idr",
    "address": {
      "bank_name": "Acme Bank",
      "account_number": "1234567890",
      "account_name": "John Doe"
    },
    "expires_at": "2026-03-04T10:06:32.4371586Z"
  },
  "hosted_url": "https://pay.example.com/pay/<charge-id>"
}
FieldDescription
typevirtual_account_transfer
virtual_account_transfer.transfer_amountThe exact amount the customer must transfer.
virtual_account_transfer.currencyCurrency code (e.g. idr).
virtual_account_transfer.address.bank_nameFull bank name to display to the customer.
virtual_account_transfer.address.account_numberThe virtual account number the customer should transfer to.
virtual_account_transfer.address.account_nameThe account name shown on the customer's banking screen.
virtual_account_transfer.expires_atWhen the virtual account expires. Display this so the customer knows the payment deadline.
hosted_urlKingsPay-hosted page that shows the transfer instructions for you.

On this page