Skip to main content
POST
Create a payment method

Authorizations

x-api-key
string
header
required

Body

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
required

Billing information for the payment method

externalId
string

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

Example:

"customer_12345"

collectFunds
enum<string>
default: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.

Available options:
NONE,
CHARGE,
HOLD
Example:

"NONE"

verificationAmount
number<decimal>
default: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.

Required range: x >= 0.01
Example:

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.

Required range: x >= 0.01
Example:

1200

displayMode
enum<string>
default:LINK

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

Available options:
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.

Example:

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

ttlMinutes
integer
default:2880

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

Required range: x >= 1
Example:

2880

Response

Payment method created successfully

Response after creating a payment method

id
string<uuid>
required

Unique identifier of the payment method

Example:

"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"

checkoutUrl
string<uri>
required

URL where the customer completes the card saving process