Saltar al contenido principal
POST
Create a payment method

Autorizaciones

x-api-key
string
header
requerido

Cuerpo

application/json

Request body for creating a payment method. The customer will be directed to the checkout URL to securely save their card. By default a small verification charge is placed and then voided to validate the card; collectFunds can instead charge or hold a real amount at that moment.

billingInformation
object
requerido

Billing information for the payment method

externalId
string

Optional external ID to track the payment method in your system.

Ejemplo:

"customer_12345"

collectFunds
enum<string>
predeterminado:NONE

What happens to the customer's money at checkout, on top of saving the card. NONE (the default) places the small verification charge and refunds it immediately, which is the historical behaviour. CHARGE keeps the money: a real sale, ending CONFIRMED. HOLD blocks the money without capturing it, ending HELD, to be captured or released later through the hold endpoints. All three modes are available to every organization.

Opciones disponibles:
NONE,
CHARGE,
HOLD
Ejemplo:

"NONE"

verificationAmount
number<decimal>
predeterminado:1

Amount in MXN used for the verification charge. This charge is placed and then voided. Defaults to $1 MXN. Allowed ONLY when collectFunds is NONE, the only mode that gives the money back; sending it with CHARGE or HOLD is a 400 telling you to use amount instead.

Rango requerido: x >= 0.01
Ejemplo:

1

amount
number<decimal>

The money that is actually charged (CHARGE) or held (HOLD) at checkout, in MXN. REQUIRED when collectFunds is CHARGE or HOLD, and rejected when collectFunds is NONE. Unlike verificationAmount, this money is not given back.

Rango requerido: x >= 0.01
Ejemplo:

1200

displayMode
enum<string>
predeterminado:LINK

How the checkout is displayed. LINK redirects the customer to a full-page checkout. EMBEDDED allows embedding in an iframe.

Opciones disponibles:
LINK,
EMBEDDED
buttonText
string

Custom text for the checkout button (EMBEDDED mode only).

buttonColor
string

Custom hex color for the checkout button (EMBEDDED mode only).

redirectUrl
string<uri>

URL where the customer is redirected after successfully saving their card. Compago appends id and externalId as query parameters.

Ejemplo:

"https://yourstore.com/cards/saved"

ttlMinutes
integer
predeterminado:2880

Time-to-live in minutes for the checkout link. Defaults to 2,880 minutes (48 hours).

Rango requerido: x >= 1
Ejemplo:

2880

bankAccountId
string<uuid> | null

Optional. The bank account that receives the money of this checkout's own charge or hold (collectFunds CHARGE or HOLD), for a business with more than one. It applies to that first charge only: later charges of the card send their own. It must be one of your verified accounts: list them with GET /developer/v1/bank-account. Omit it, or send null, and Compago applies your deposit rule. An id that is not one of your verified accounts fails with BANK_ACCOUNT_NOT_AVAILABLE and no checkout link is created.

Ejemplo:

"5b1d7c2e-8a34-4f6b-9c1d-0e2f3a4b5c61"

Respuesta

Payment method created successfully

Response after creating a payment method

id
string<uuid>
requerido

Unique identifier of the payment method

Ejemplo:

"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"

checkoutUrl
string<uri>
requerido

URL where the customer completes the card saving process