Create a payment (pay-in)
const url = 'https://api.pachapay.io/v1/payments';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"amount":100000,"currency":"CLP","country":"CL","method_code":"CL.KHIPU","merchant_reference":"order-8841","payer":{"name":"Maria Lopez","email":"maria@example.com","document":{"type":"RUT","number":"12345678-5"}},"return_url":"https://merchant.example/return"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pachapay.io/v1/payments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "amount": 100000, "currency": "CLP", "country": "CL", "method_code": "CL.KHIPU", "merchant_reference": "order-8841", "payer": { "name": "Maria Lopez", "email": "maria@example.com", "document": { "type": "RUT", "number": "12345678-5" } }, "return_url": "https://merchant.example/return" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Unique key per logical operation, up to 255 characters. Keys are kept for 24 hours. Same key with a different body returns 409 idempotency_conflict, and the same key while the first request is still running returns 409 idempotency_in_progress.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Minor units.
ISO 4217 code. Crypto assets are not accepted in this field.
ISO 3166-1 alpha-2. Target countries for the first release are CL, CO, EC, PE, MX and BR; availability per country depends on the agreement with the payment provider.
Your own order id.
object
E.164 format.
object
Payer IP address, optional. Used for risk checks.
Opaque device identifier from the merchant, optional. Used for risk checks.
Hosted sends the payer to checkout_url, s2s lets you show next_action in your own UI.
Up to 20 string keys, values up to 500 characters. Returned as is.
object
Example
{ "amount": 100000, "currency": "CLP", "country": "CL", "method_code": "CL.KHIPU", "merchant_reference": "order-8841", "payer": { "name": "Maria Lopez", "email": "maria@example.com", "document": { "type": "RUT", "number": "12345678-5" } }, "return_url": "https://merchant.example/return"}Responses
Section titled “Responses”Payment created. Follow next_action to complete it.
object
expired is not final: a late payment moves it to succeeded.
partially_paid and overpaid apply to transfers. chargeback applies to cards.
Amount the merchant asked for.
Amount actually received so far.
Our fee on the received amount, same currency.
Received amount minus fee.
ISO 4217 code. Crypto assets are not accepted in this field.
ISO 3166-1 alpha-2. Target countries for the first release are CL, CO, EC, PE, MX and BR; availability per country depends on the agreement with the payment provider.
Hosted checkout page, set for the hosted flow.
Total refunded so far in minor units.
object
E.164 format.
object
Payer IP address, optional. Used for risk checks.
Opaque device identifier from the merchant, optional. Used for risk checks.
What the payer must do next. Show it or redirect the payer.
object
object
Reference the payer must include.
Up to 20 string keys, values up to 500 characters. Returned as is.
object
Example
{ "id": "pay_0192f3a1", "object": "payment", "status": "created", "currency": "CLP", "country": "CL", "method_family": "card", "flow": "hosted", "payer": { "document": { "type": "RUT" } }, "next_action": { "type": "redirect" }}Too many requests. Retry after the number of seconds in Retry-After.
object
object
Stable machine-readable code that does not change within a major version. Examples are
parameter_invalid, parameter_missing, amount_out_of_range, api_key_invalid,
api_key_revoked, merchant_not_active, method_not_allowed, country_not_allowed,
resource_not_found, idempotency_conflict, idempotency_in_progress, invalid_state,
insufficient_balance, method_not_available, blocked_payer, limit_exceeded,
rate_limited, internal_error, provider_unavailable, service_unavailable.
Name of the offending parameter, if any.
Example
{ "error": { "type": "invalid_request_error" }}Headers
Section titled “Headers”Seconds to wait before retrying.
Requests allowed in the current window.
Requests left in the current window.
Seconds until the window resets.
Error. See error.code.
object
object
Stable machine-readable code that does not change within a major version. Examples are
parameter_invalid, parameter_missing, amount_out_of_range, api_key_invalid,
api_key_revoked, merchant_not_active, method_not_allowed, country_not_allowed,
resource_not_found, idempotency_conflict, idempotency_in_progress, invalid_state,
insufficient_balance, method_not_available, blocked_payer, limit_exceeded,
rate_limited, internal_error, provider_unavailable, service_unavailable.
Name of the offending parameter, if any.
Examples
Merchant not approved
{ "error": { "type": "permission_error", "code": "merchant_not_active", "message": "KYB is not approved for this merchant.", "request_id": "req_01" }}Not enough balance
{ "error": { "type": "invalid_state_error", "code": "insufficient_balance", "message": "Available balance is lower than the amount plus fee.", "param": "amount", "request_id": "req_02" }}Error. See error.code.
object
object
Stable machine-readable code that does not change within a major version. Examples are
parameter_invalid, parameter_missing, amount_out_of_range, api_key_invalid,
api_key_revoked, merchant_not_active, method_not_allowed, country_not_allowed,
resource_not_found, idempotency_conflict, idempotency_in_progress, invalid_state,
insufficient_balance, method_not_available, blocked_payer, limit_exceeded,
rate_limited, internal_error, provider_unavailable, service_unavailable.
Name of the offending parameter, if any.
Examples
Merchant not approved
{ "error": { "type": "permission_error", "code": "merchant_not_active", "message": "KYB is not approved for this merchant.", "request_id": "req_01" }}Not enough balance
{ "error": { "type": "invalid_state_error", "code": "insufficient_balance", "message": "Available balance is lower than the amount plus fee.", "param": "amount", "request_id": "req_02" }}