Saltar al contenido principal
POST
Create a payment intent

Autorizaciones

x-api-key
string
header
requerido

Cuerpo

application/json

Request body for creating a payment intent. Payment intents represent card-present payment requests that are processed by POS terminals.

amount
number<decimal>
requerido

The amount to charge in MXN. Must be a positive number.

Ejemplo:

350.5

currency
enum<string>
predeterminado:MXN
requerido

Currency of amount and tipAmount. With USD the terminal shows the price in dollars and charges the card in MXN at the exchange rate of the moment the card is read. A terminal on an app version without dollar prices refuses the intent with INVALID_PAYMENT_AMOUNT and asks for an update. See Prices in US dollars.

Opciones disponibles:
MXN,
USD
Ejemplo:

"MXN"

externalId
string
requerido

Your unique identifier for this payment intent. Must be unique per organization.

Ejemplo:

"order_12345_pos"

terminalCode
string

Serial number of the target POS terminal. If provided, the payment intent is routed to that specific terminal and any other pending intents for that terminal are automatically cancelled. If omitted, the payment intent is available to any terminal in your organization.

Ejemplo:

"TERMINAL-001"

redirectAppId
string

Android application id of the app the Compago POS app returns to after the payment finishes (successfully or cancelled). Overrides the integration configured locally on the terminal. If omitted, the terminal falls back to its local integration configuration. Requires the app to be installed on the terminal device.

Maximum string length: 255
Ejemplo:

"com.mycompany.pos"

bankAccountId
string<uuid> | null

Optional. The bank account that receives the money of this payment intent, for a business with more than one. 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, exactly as it did before this field existed: with one account the money goes there, with automatic sharing the rule picks the account, and with manual sharing it goes to your default account. An id that is not one of your verified accounts fails with BANK_ACCOUNT_NOT_AVAILABLE.

Ejemplo:

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

allocations
object[] | null

Optional. Splits the money of this payment intent between several of your bank accounts: each part names an account and the amount it receives. What the parts leave of the amount follows your deposit rule. The tip, the fee and its IVA are shared out between the parts that pay the fee, in centavos. Up to 5 parts, in MXN charges only, and never together with bankAccountId; what the parts leave counts as one more, so five parts must add up to the whole amount. The parts may not add up to more than amount, and when they add up to all of it at least one must pay the fee (absorbsFee). A request that breaks a rule fails with BANK_ACCOUNT_ALLOCATIONS_INVALID; an account that is not one of your verified accounts fails with BANK_ACCOUNT_NOT_AVAILABLE.

Required array length: 1 - 5 elements
Ejemplo:
allowedTerms
integer[] | null

The installment plans the terminal may charge, as numbers of months (1 is a single payment, 3 is 3 meses sin intereses). Send several to limit what the terminal offers, or one to fix the plan the cashier already chose at the till: the terminal then skips its plan screen. Every value must be a card-present plan active for your account, or the request is refused with ALLOWED_TERMS_UNAVAILABLE. Omit it (or send null) to offer every active plan. An empty list is refused.

Minimum array length: 1
Rango requerido: 1 <= x <= 48
Ejemplo:
printVoucher
boolean
predeterminado:true

When the terminal prints the card voucher. It always prints it: true right after the approval, false right under the next receipt your system prints on the terminal (or on its own after a minute without one).

Ejemplo:

false

tipAmount
number<decimal> | null

Optional. A tip your till already took, in the intent's currency, charged on top of amount in the same card charge. The terminal shows the total and does not ask for a tip. At most 30% of amount, in whole cents (TIP_EXCEEDS_LIMIT, TIP_INVALID_AMOUNT). It does not need tips turned on for the business. Cannot be sent with collectTip.

Ejemplo:

52.5

collectTip
boolean
predeterminado:false

Optional. true has the terminal ask the customer for a tip (10, 15 or 20%, another amount, or none) before the card, as on a sale typed on the terminal. The business must have tips turned on, or the request is refused with TIPS_DISABLED. Cannot be sent with tipAmount. Omit it, or send false, to charge amount with no tip, as before.

Ejemplo:

true

Respuesta

Payment intent created successfully

The created payment intent object

id
string<uuid>
requerido

Unique identifier of the payment intent

Ejemplo:

"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"

status
enum<string>
requerido

Initial status is always PENDING

Opciones disponibles:
PENDING
amount
number<decimal>
requerido

The payment amount

currency
string
requerido
Ejemplo:

"MXN"

externalId
string
requerido

Your external identifier

redirectAppId
string | null

Android application id the terminal returns to after the payment finishes, if provided at creation

Ejemplo:

"com.mycompany.pos"

bankAccountId
string<uuid> | null

The bank account this payment intent asked for. null follows your deposit rule.

organizationId
string<uuid>

The organization that owns this payment intent

Ejemplo:

"11111111-2222-3333-4444-555555555555"

terminalId
string<uuid>

The terminal associated with this payment intent, if any

Ejemplo:

"66666666-7777-8888-9999-000000000000"

createdAt
string<date-time>
updatedAt
string<date-time>
allowedTerms
integer[] | null

The plans the terminal may charge, sorted and without repeats. null offers every active plan.

Ejemplo:
printVoucher
boolean

false when the terminal prints the card voucher under your system's receipt instead of right after the approval.