Skip to Content
KingsPay Docs

Create Payment Charge

Create a new payment charge for your customer to pay.

POST
/v1/payments/charges

Create a new payment charge for your customer to pay.

Authorization

API Key
headerAuthorizationBearer <token>

Your API key for the API. You can find it in your integration settings. Starts with sk_

Header Parameters

On-Behalf-Of?string

Only for platforms with connected accounts. The ID of a connected account to create this charge as; the charge then belongs to that account. It must be actively connected to the account that owns the API key. Leave it out to create the charge for your own account.

Formatuuid
Idempotency-Key?string

Unique key to safely retry this request. Repeating a key returns the original response instead of performing the operation again.

Request Body

application/json
  1. body
payment_method*string

The code of a payment method enabled for the account. Get the available codes from the code field of List Payment Methods.

customer_details*
currency*string
Default"idr"
amount*number
Formatdouble
Default0
payment_method_options?null|
expires_at?|
Formatdate-time
client_reference_id?null|string
description?null|string
application_fee_amount?|

Only for platforms, together with the On-Behalf-Of header. The part of amount your platform account keeps as its fee once the charge succeeds. Must be greater than 0, and together with the processing fee must not exceed amount.

Formatdouble
items?null|array<>

Response Body

OK

application/json
  1. response
data*
status?string
Example Request
curl -X POST 'https://api.kingsplatform.net/api/v1/payments/charges' \  -H 'Content-Type: application/json' \  -d '{  "payment_method": "string",  "customer_details": {    "email": "string"  },  "currency": "idr",  "amount": 0}'
Example Response
{  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "client_reference_id": null,    "payment_method": null,    "account": null,    "platform_account": null,    "payment_method_options": null,    "description": null,    "currency": "string",    "status": "string",    "amount": 0.1,    "fee": 0.1,    "application_fee_amount": null,    "net_amount": 0.1,    "customer_details": null,    "items": null,    "payment_action": null,    "paid_at": null,    "settles_at": null,    "expires_at": null,    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "status": "string"}