PayConsults API

Merchants integrate once. PayConsults routes each payment to an eligible
provider based on country, currency, payment method and what that merchant
is approved to use, then normalises the provider's statuses, errors and
webhooks into one shape.

Amounts are integers in minor units. 15000 is 150.00 BRL. Zero-decimal
currencies exist — 15000 IDR really is 15000.

Test and live are separate. A pc_test_ key reaches only the built-in
sandbox; a pc_live_ key never does.

The webhook is what proves payment, not the customer arriving back on
your return_url — anyone can visit that URL.

Recurring is explicit. A payment is a recurring charge only when it was
taken against a mandate — a standing authorisation the customer agreed to.
A customer who buys the same thing twice in two months has made two one-off
payments, and both will report is_recurring: false. Nothing is inferred
from the customer, the payment method, the amount or the interval.

Download the OpenAPI document →

API Key:
Enter your API key once here to unlock the interactive Try it out console on each endpoint below.

Authentication

Your API key: Authorization: Bearer pc_test_… or pc_live_….

curl https://api.payconsults.com/v1/payments \
  -H "Authorization: Bearer pc_test_..."

Endpoints

POST /v1/payments Create a payment

Returns a redirect_url — send the customer there. Omit payment_method to use provider-hosted checkout, where the customer chooses on the provider's page and no method-specific fields are required.

Parameters

Idempotency-Key header Replaying a key returns the first response instead of acting twice. Reusing one with a different body is an error. 8–255 characters.

Body

FieldTypeDescription
merchant_reference required string Your own order id. Must be unique for you, and is echoed on every webhook. "ORDER-1001"
deposit_group string Optional. Your id for the underlying order or deposit, shared by every attempt at it. While an attempt in the group is still in flight a new one is refused with DEPOSIT_GROUP_IN_FLIGHT and the live attempt is returned in error.detail, so you can send the customer back to the checkout they already have instead of opening a second payable one. Once every attempt is failed, expired or cancelled, a retry is allowed. Omit it and nothing changes. "DEP-99312"
amount required integer Minor units. 15000 is 150.00 BRL. 15000
currency required string ISO-4217. "BRL"
country required string ISO-3166 alpha-3. "BRA"
payment_method string Omit for provider-hosted checkout.
bank_transferboletocarddanahosted_checkoutidealmobile_moneympesaovopay_with_bankpixqrissbpshopeepaystcpaytabbyupi
payment_method_data object Fields a specific method needs that the shared model does not own, e.g. {"vpa":"customer@upi"}.
provider string Pin to one provider. Fails rather than substituting if it cannot serve the request.
sandboxdukpaykorapay
return_url string Where the customer lands afterwards.
statement_descriptor string Shown on the checkout page and, where supported, the statement.
customer Customer
metadata object Yours. Stored and returned untouched.

Responses

200This reference already existed, or the Idempotency-Key was replayed.
201Created.
401Missing or invalid API key.
402The provider declined the payment outright.
403This merchant is not enabled for that country or method.
409A payment for this reference is already being created.
422The request was understood but cannot be fulfilled.
429Rate limited. Obey `Retry-After`.

Status: — Latency: —

    
GET /v1/payments List payments

Parameters

limit query How many to return, 1–100.
starting_after query A next_cursor from a previous page.
status query Only this status.
createdpendingprocessingsucceededfailedcancelledexpiredrefundedpartially_refunded
currency query ISO-4217, e.g. BRL.
country query ISO-3166 alpha-3, e.g. BRA.
provider query Only payments routed to this provider.
sandboxdukpaykorapay
search query Match a merchant reference or provider transaction id.

Responses

200A page of payments, newest first.
401Missing or invalid API key.

Status: — Latency: —

    
GET /v1/payments/{merchant_reference} Fetch a payment

Looks up by your own reference. If the payment has not reached a final state, the provider is asked for the latest before answering.

Parameters

merchant_reference required path The reference you supplied when creating it.
refresh query Set false to skip asking the provider.

Responses

200The payment.
404No payment with that reference.

Status: — Latency: —

    
POST /v1/payments/{merchant_reference}/cancel Cancel a payment

Only a payment that has not settled. Where the provider offers no cancel operation the payment is still marked cancelled here, and provider_notified is false.

Parameters

merchant_reference required path The reference to cancel.

Responses

200Cancelled.
404No payment with that reference.
422Already settled, so no longer cancellable.

Status: — Latency: —

    
POST /v1/refunds Refund a payment

Omit amount to refund whatever is left. The payment moves to partially_refunded, then refunded once nothing remains.

Parameters

Idempotency-Key header Replaying a key returns the first response instead of acting twice. Reusing one with a different body is an error. 8–255 characters.

Body

FieldTypeDescription
payment_reference required string The merchant_reference of the payment.
amount integer Minor units. Omit to refund what remains.
merchant_reference string Your id for this refund.
reason string

Responses

201Accepted.
404No payment with that reference.
422Not refundable, or more than remains.

Status: — Latency: —

    
POST /v1/payouts Create a payout

Disburse funds to a beneficiary. The payout moves to processing, then succeeded or failed.

Parameters

Idempotency-Key header Replaying a key returns the first response instead of acting twice. Reusing one with a different body is an error. 8–255 characters.

Body

FieldTypeDescription
merchant_reference required string Your unique reference for this payout.
amount required integer Minor units (e.g. 1500 for 15.00).
amount_decimal string Human decimal string alternative (e.g. "15.00").
currency required string Three-letter ISO code.
country string Three-letter ISO country code.
payment_method string Disbursement method (e.g. pix, bank_transfer).
beneficiary required object Recipient account and identity information.
provider string Explicit provider override if desired.
provider_options object Pass-through provider options.

Responses

201Created.
422No capable provider or invalid payout parameters.

Status: — Latency: —

    
GET /v1/payouts List payouts

Parameters

limit query Page size, 1 to 100.
status query Filter by payout status.

Responses

200Payouts, newest first.

Status: — Latency: —

    
GET /v1/payouts/{merchant_reference} Fetch a payout

Parameters

merchant_reference required path Your reference for the payout.
refresh query false skips asking the PSP and serves from cache.

Responses

200The payout.
404No such payout.

Status: — Latency: —

    
POST /v1/mandates Ask a customer to authorise future charges

Returns a redirect_url the customer must complete. Until they do, the mandate is pending and cannot be charged. This is the only way a payment ever becomes recurring.

Body

FieldTypeDescription
merchant_reference required string Your id for this authorisation.
country required string
currency required string
payment_method string
bank_transferboletocarddanahosted_checkoutidealmobile_moneympesaovopay_with_bankpixqrissbpshopeepaystcpaytabbyupi
provider string
sandboxdukpaykorapay
customer Customer
metadata object

Responses

201Created.
422The chosen provider does not support recurring charges.

Status: — Latency: —

    
GET /v1/mandates List authorisations

Responses

200Authorisations, newest first.

Status: — Latency: —

    
GET /v1/mandates/{merchant_reference} Fetch an authorisation

Parameters

merchant_reference required path Your reference for the authorisation.

Responses

200The authorisation.
404No such authorisation.

Status: — Latency: —

    
POST /v1/mandates/{merchant_reference}/cancel Withdraw an authorisation

Cancels every subscription billing against it too. Consent withdrawn must stop the money, not just the record of it.

Parameters

merchant_reference required path The authorisation to withdraw.

Responses

200Cancelled.

Status: — Latency: —

    
POST /v1/subscriptions Start a subscription

Bills an existing mandate on a schedule. Where the provider runs its own scheduler we mirror it; otherwise PayConsults runs the clock, retries failed renewals, and gives up only after the dunning schedule is exhausted.

Body

FieldTypeDescription
merchant_reference required string
mandate_id required string An authorisation the customer has completed.
amount required integer Minor units, charged each period.
currency required string
interval required string
dayweekmonthyear
interval_count integer e.g. interval month, count 3 = quarterly.
total_periods integer Stop after this many. Omit to run until cancelled.
start_now boolean False to bill at the end of the first period.
description string
metadata object

Responses

201Created.
404No such mandate.
422The mandate is cancelled or failed.

Status: — Latency: —

    
GET /v1/subscriptions List subscriptions

Parameters

status query Only this status.
pending_mandateactivepast_duepausedcancelledcompleted

Responses

200Subscriptions, newest first.

Status: — Latency: —

    
GET /v1/subscriptions/{merchant_reference} Fetch a subscription and its charges

Includes every charge billed against it, in order.

Parameters

merchant_reference required path Your reference for the subscription.

Responses

200The subscription, with its charges.
404No such subscription.

Status: — Latency: —

    
POST /v1/subscriptions/{merchant_reference}/cancel Cancel a subscription

Parameters

merchant_reference required path The subscription to cancel.

Body

FieldTypeDescription
at_period_end boolean Let the paid period run out first.

Responses

200Cancelled.

Status: — Latency: —

    
POST /v1/subscriptions/{merchant_reference}/pause Pause billing

Parameters

merchant_reference required path The subscription to pause.

Responses

200Paused.
422The provider runs this schedule, so it cannot be paused here.

Status: — Latency: —

    
POST /v1/subscriptions/{merchant_reference}/resume Resume billing

Parameters

merchant_reference required path The subscription to resume.

Responses

200Resumed.

Status: — Latency: —

    
GET /v1/payment-methods What this merchant may use

The providers connected to this merchant, intersected with what they are approved for. Carries the limits and required fields for each, so a checkout page can be built without guessing.

Parameters

country query Filter by country.
currency query Filter by currency.

Responses

200Available methods.

Status: — Latency: —

    
GET /v1/routes Which providers this key can reach

Responses

200Connected providers, in precedence order.

Status: — Latency: —

    
GET /v1/events Recent webhook deliveries

Every attempt, successful or not, for debugging your endpoint.

Responses

200Recent delivery attempts.

Status: — Latency: —

    

The payment object

FieldTypeDescription
object string
payment_id string Ours. Quote this to support. "pay_9f2c…"
merchant_reference string Yours.
status string
createdpendingprocessingsucceededfailedcancelledexpiredrefundedpartially_refunded
amount integer Minor units.
currency string
country string
payment_method string | null
redirect_url string | null Send the customer here.
qr_code string | null
failure_code string | null
failure_message string | null
fees object
amount_refunded integer Minor units returned so far.
deposit_group string | null The order or deposit this attempt belongs to, if you sent one.
expired_by string | null Set only when status is expired. provider means the PSP closed the checkout session: final, nothing more will arrive. gateway means our clock gave up without a verdict, so a late settlement can still land and will still be webhooked. Providers differ — Korapay reports expiry, DukPay has no expired status at all and emits nothing for an abandoned checkout, which is why the clock exists.
providergateway
expires_at string | null When this attempt stops being payable. Past it the status becomes expired and the deposit group reopens for a retry. expired means we stopped waiting, not that the payment was declined: a settlement arriving afterwards is still accepted and still webhooked.
is_recurring boolean True only when this charge was billed against a subscription. A repeat purchase by the same customer, with the same method, is false.
mandate_id string | null The standing authorisation used, if any.
subscription_id string | null The subscription billed, if any.
initiator string customer when they were present; merchant when a stored authorisation was charged.
customermerchant
sequence integer | null Which period of the subscription this is.
reconciliation_date string | null YYYY-MM-DD, where the provider reports one.
created_at string
updated_at string
provider object

Statuses

createdpendingprocessingsucceededfailedcancelledexpiredrefundedpartially_refunded

Every provider's own vocabulary maps into exactly these.

Errors

Branch on code. It is stable; the message may be reworded.

{
  "error": {
    "code": "AMOUNT_BELOW_MINIMUM",
    "type": "invalid_request",
    "message": "The minimum for boleto in BRA is 500 minor units.",
    "param": "amount",
    "request_id": "req_9f2c…"
  }
}
INVALID_REQUESTMISSING_REQUIRED_FIELDINVALID_FIELD_FORMATINVALID_AMOUNTAMOUNT_BELOW_MINIMUMAMOUNT_ABOVE_MAXIMUMUNSUPPORTED_CURRENCYUNSUPPORTED_COUNTRYUNSUPPORTED_PAYMENT_METHODUNAUTHENTICATEDPERMISSION_DENIEDPAYMENT_METHOD_NOT_ENABLEDCOUNTRY_NOT_ENABLEDNO_ELIGIBLE_PROVIDERPROVIDER_NOT_AVAILABLEPROVIDER_DECLINEDPROVIDER_ERRORPROVIDER_TIMEOUTPSP_AUTHENTICATION_FAILEDPSP_CREDENTIALS_MISSINGPSP_CREDENTIALS_EXPIREDPSP_TOKEN_REFRESH_FAILEDPSP_SIGNATURE_INVALIDPSP_CONFIGURATION_ERRORPSP_INVALID_RESPONSEPSP_UNAVAILABLEPSP_RATE_LIMITEDPAYMENT_NOT_FOUNDDUPLICATE_PAYMENTPAYMENT_IN_PROGRESSDEPOSIT_GROUP_IN_FLIGHTCANCEL_NOT_ALLOWEDIDEMPOTENCY_CONFLICTRECURRING_NOT_SUPPORTEDMANDATE_NOT_ACTIVEMANDATE_NOT_FOUNDSUBSCRIPTION_NOT_FOUNDSUBSCRIPTION_NOT_ACTIVEREFUND_NOT_SUPPORTEDREFUND_NOT_ALLOWEDCANCEL_NOT_SUPPORTEDINTERNAL_ERRORRATE_LIMITED

Webhooks

We POST to your configured URL, signed as
PayConsults-Signature: t=<unix>,v1=<hex hmac> — an HMAC-SHA256 of
"<timestamp>.<raw body>" using your webhook secret. Compare in constant
time, reject anything older than five minutes, and answer 200 quickly.
Failures are retried with backoff, so make handling idempotent.

data is the same shape this API returns, so one parser handles both.

payment.succeededpayment.failedpayment.cancelledpayment.expiredpayment.refundedpayment.partially_refundedpayment.fees_availablerefund.succeededrefund.failedpayout.succeededpayout.failedmandate.activatedmandate.failedmandate.cancelledsubscription.createdsubscription.activatedsubscription.renewedsubscription.payment_failedsubscription.pausedsubscription.resumedsubscription.cancelledsubscription.completedsubscription.updatedchargeback.openedchargeback.lost
{
  "id": "evt_…",
  "type": "payment.succeeded",
  "created_at": "2026-09-08T09:00:00.000Z",
  "data": {
    "object": "payment",
    "payment_id": "pay_…",
    "merchant_reference": "ORDER-1001",
    "status": "succeeded"
  }
}