The Automatic Payment API (version 1.0) by Khipu allows merchants to set up recurring payment subscriptions using bank debits (PAC). Through the POST /v1/automatic-payment/subscription endpoint, merchants submit details such as the subscription name, customer email, maximum amount, currency, and URLs for notification, return, or cancellation. Upon success, the API returns a unique subscription_id and a redirect_url where the user can authorize the debit mandate with their bank. Merchants can later query and manage the PAC status using additional endpoints. Authentication is handled via the x-api-key header.
https://payment-api.khipu.com/
Name to identify the subscription.
URL that will be called when the customer complete the signing process with the bank. A JSON message will be sent via POST with the information of the subscription with the following structure (status
can be "enabled" or "disabled"):
{
"subscription_id": string,
"status": "enabled"
}
URL to redirect the customer when the signing process has been completed.
URL to redirect the customer if the signing process could not be completed.
Value to associate with the subscription. It can be useful when you don't want your client to be identified with a random unique string in the bank's mandate subscription form.
URL of the image associated with the subscription.
https://payment-api.khipu.com/v1/automatic-payment/subscription
curl -i -X POST \
https://payment-api.khipu.com/v1/automatic-payment/subscription \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY_HERE' \
-d '{
"name": "Service XYZ Id 11.222.333-0",
"email": "personal.email@gmail.com",
"max_amount": 1000,
"currency": "CLP",
"notify_url": "https://my-domain.biz/subscription-notify-api",
"return_url": "https://my-domain.biz/subscription-result",
"cancel_url": "https://my-domain.biz/subscription-cancel"
}'
Successful operation. Returns a JSON object with the subscription id that can be used to ask the customer to sign the direct debit mandate.
Unique subscription identifier, to be associated with the service acquired by the customer. Subsequently, this value can be used to check the status of the subscription.
{ "subscription_id": "13a0f1aa-5e47-4894-aa8b-282dd19593ec", "redirect_url": "https://khipu.com/pac-manager/13a0f1aa-5e47-4894-aa8b-282dd19593ec" }
https://payment-api.khipu.com/v1/automatic-payment/subscription/{id}
curl -i -X GET \
'https://payment-api.khipu.com/v1/automatic-payment/subscription/{id}' \
-H 'x-api-key: YOUR_API_KEY_HERE'
Successful operation. Returns a JSON object with the subscription id information.
Unique subscription identifier.
The current status of the subscription. A charge intent can only be made if the status is ENABLED
.
Indicates if the subscription was created using the sandbox environment. A false
value means that is a production subscription.
The bank used by the customer to sign the subscription. The possible values are the ones used in the Khipu Payment API, or no-bank
if the subscription has not been signed.
{ "subscription_id": "13a0f1aa-5e47-4894-aa8b-282dd19593ec", "status": "SIGNED", "developer": false, "customer_bank_code": "8", "service_reference": "My Merchant name" }
The subscription id that will be charged.
Amount that will be charged. Do not use thousands separator, and a maximum of 4 decimal places. It will assume the currency in which the merchant registered its account in Khipu.
Subject to identify the charge.
Charge description.
URL that will be called if an error occurs in the charge process. A JSON will be sent by POST with the following structure:
{
"subscription_id": string,
"transaction_id": string,
"error_message": string
}
This field can be used to send custom information about the charge intent. It can be in text format or base64-encoded document.
Merchant's unique identifier for this operation. For example, the invoice number.
URL that will be called once the charging process finishes and the payment is conciliated. A POST will be sent with parameters that allows fetch the payment details, using the same flow of a normal payment. See the documentation for details.
https://payment-api.khipu.com/v1/automatic-payment/charge-intent
curl -i -X POST \
https://payment-api.khipu.com/v1/automatic-payment/charge-intent \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY_HERE' \
-d '{
"subscription_id": "13a0f1aa-5e47-4894-aa8b-282dd19593ec",
"amount": 10000,
"subject": "Charge Service XYZ Id 11.222.333-0",
"body": "Service XYZ - November 2022 - Amount: $10.000",
"error_response_url": "https://my-domain.biz/charge-error-api",
"custom": "Custom information content.",
"transaction_id": "INVOICE-23ffcfbe1e4a4d1c9dc631fe70bddaa0",
"notify_url": "https://my-domain.biz/charge-notify-api"
}'
{ "payment_id": "v67prof2ugg3" }