Saltar al contenido principal
POST
Create a one-time-payment link

Autorizaciones

x-api-key
string
header
requerido

Cuerpo

application/json

Request body for creating a one-time payment link. You can redirect the user to the resulting URL to complete the payment, the payment will be processed by the Compago platform, and then the user will be redirected back to the homepage URL provided.

amount
number<decimal>
requerido

The amount to be charged for the one-time payment. Must be a positive number.

Ejemplo:

100

currency
enum<string>
predeterminado:MXN
requerido

Currency of amount. With USD the price is shown in dollars and the card is charged in MXN at the exchange rate of the moment the customer pays (Banxico's FIX plus your markup). USD takes card payments only: paymentMethods must include CARD and paymentMethodOptions.bankTransfer is refused. See Prices in US dollars.

Opciones disponibles:
MXN,
USD
Ejemplo:

"MXN"

externalId
string
requerido

Optional external ID to track the payment in your system. Must be unique for each payment.

Ejemplo:

"tracking-id-from-your-system"

description
string
requerido

A description of the payment. This will be displayed to the user during the payment process.

Ejemplo:

"Lorem ipsum dolor sit amet"

homepageUrl
string<uri>
requerido

The homepage URL of your application to link the user back to your application in case they cancel the payment or want to go back. This should be a valid URL that your application can handle.

Ejemplo:

"https://app.compago.com/"

redirectUrl
string<uri>
requerido

The URL of your application to redirect the user back to after the payment is completed. This should be a valid URL that your application can handle.

Ejemplo:

"https://app.compago.com/"

billingInformation
object

Optional. Send it when you already know the customer and the checkout asks only for the card. Omit it and the checkout asks the payer for their own name, email and phone alongside the card. Either way the details end up on the payment once it is paid.

ttlMinutes
integer

Optional time-to-live in minutes for the payment link. Minimum 10 minutes, maximum 2,880 minutes (48 hours). Defaults to 48 hours if not specified.

Rango requerido: 10 <= x <= 2880
Ejemplo:

1440

allowedTerms
integer[] | null

Optional. The installment plans the checkout offers, as numbers of monthly installments: 1 is a single payment and any larger number is that many months without interest (MSI). Send one term, for example [12], and the customer pays with that plan without being able to choose another. Send several, for example [3, 6], and the customer chooses among them. Omit it, or send null, to offer every plan active on your account. Every term must be active on your account when you create the payment, otherwise the request fails with ALLOWED_TERMS_UNAVAILABLE. Duplicates are removed and the list is stored sorted. The checkout never offers a plan outside this list, and it drops any listed plan that stops being available before the customer pays.

Required array length: 1 - 48 elements
Rango requerido: 1 <= x <= 48
Ejemplo:
paymentMethods
enum<string>[] | null

The ways to pay the checkout offers: CARD, BANK_TRANSFER (every bank transfer your account takes: in Mexico, SPEI to a CLABE made for the purchase) and SPEI (only SPEI transfers). null or omitted offers every method available to your account. A payment that offers only bank transfers is rejected with SPEI_NOT_OFFERED unless SPEI is enabled for your account and amount reaches your SPEI minimum.

Opciones disponibles:
CARD,
BANK_TRANSFER,
SPEI
Ejemplo:
defaultPaymentMethod
enum<string> | null

The method the checkout opens on, one of paymentMethods. null opens on the first one offered.

Opciones disponibles:
CARD,
BANK_TRANSFER,
SPEI,
null
Ejemplo:

"BANK_TRANSFER"

bankAccountId
string<uuid> | null

Optional. The bank account that receives the money of this payment, 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 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:
paymentMethodOptions
object

Settings for one payment method, only for a method paymentMethods offers. Sending options for a method it leaves out is rejected with PAYMENT_METHOD_NOT_OFFERED.

Respuesta

Link successfully created

redirectUrl
string<uri>
requerido
bankTransfer
object | null

The CLABE, with paymentMethodOptions.bankTransfer.generateAt: CREATE. null otherwise, or when the CLABE could not be made right then: ask for it with POST /developer/v1/one-time-payment/{id}/bank-transfer.