What You Can Do
With one-time payments, you can:- Generate Secure Payment Links: Create unique, time-limited checkout URLs for each transaction
- Accept Card Payments: Process credit and debit card payments through Compago’s PCI-compliant infrastructure
- Customize the Experience: Control where customers are redirected after payment completion
- Track Payments: Use your own external IDs to link Compago payments with your internal systems
- Offer Installment Plans: Support monthly installment payments (Meses Sin Intereses) when available, and choose exactly which plans each payment offers
- Set Custom Expiration Times: Configure payment link expiration from 10 minutes to 48 hours based on your needs
Use Cases
One-time payments are perfect for:- Invoicing: Send payment links to customers via email or messaging
- Custom Integrations: Trigger payments from CRM, ERP, or internal tools
- eCommerce: Accept payments for online stores and marketplaces
- Service Businesses: Request deposits or full payments for appointments or bookings
- Point of Sale: Create payment links for in-person transactions (when integrated with terminal apps)
How It Works
- Create: Your backend calls the Compago API to create a payment link, providing the amount, customer details, and redirect URLs
- Receive: Compago returns a secure checkout URL where your customer will complete the payment
- Redirect: Send your customer to the checkout URL where they enter their payment details
- Process: Compago processes the payment securely through its payment infrastructure
- Callback: After successful payment, Compago redirects the customer back to your
redirectUrlwith query parametersidandexternalIdappended - Verify: On your callback page, extract the payment
idfrom the URL and fetch the final payment status using the GET endpoint - Fulfill: Update your internal systems (mark order as paid, send confirmation email, etc.)
Prerequisites
Before creating one-time payments, ensure you have:- An active Compago account with API access
- A valid API key, created at Configuraciones → Desarrollador in the dashboard of the environment you call (
demo-app.compago.comfor Demo,app.compago.comfor Production). See Environments. - Your integration configured to use MXN currency
One-time payments currently support MXN (Mexican Peso) only. Transactions in other currencies will be rejected.
Creating a One-Time Payment
These examples call the production host. While you build, replace
https://api-harmony.compago.com with https://demo-api-harmony.compago.com and use a key from the Demo dashboard. See Environments.Endpoint
POST /one-time-payment
Authentication
Include your API key in the request headers:Request Body
Field Descriptions
Billing Information
The object as a whole is optional. When you do send it, these fields are all required.Address
Response
redirectUrl to redirect your customer to Compago’s secure checkout page.
Example with cURL
Who provides the customer details
Compago needs the payer’s name, email and phone to process a card. There are two ways it gets them, and you choose per payment by includingbillingInformation or leaving it out.
You already know the customer. Send billingInformation when you create the payment. The checkout page asks only for the card and lets the customer correct the phone number, so they type as little as possible. This is the right choice for invoicing, for an online store that already has an account, or for anywhere your system holds the customer record.
You do not know the customer. Leave billingInformation out. The checkout page then asks the payer for their own name, email and phone alongside the card, exactly as a Compago payment link does. This is the right choice for a counter or a QR code handed to a walk-in, where asking a stranger to read out their email is slower than letting them type it themselves.
Either way the details end up on the payment, so a charge created without them is fully attributed once it is paid. Nothing else about the integration changes.
Sending
billingInformation remains fully supported and is unchanged. If your integration already sends it, you do not need to do anything.Choosing the installment plans
By default the checkout offers every installment plan active on your account, and the customer picks one. SendallowedTerms to decide the financing yourself: the checkout offers only the plans you list, and the customer cannot choose any other.
Each entry is a number of monthly installments, the same terms a payment carries once it is paid. 1 is a single payment, and any larger number is that many months without interest (MSI).
- Every entry must be a whole number from 1 to 48, and the list cannot be empty. To offer every plan, leave the field out.
- Every entry must be a plan active on your account when you create the payment. Otherwise the request is rejected with
ALLOWED_TERMS_UNAVAILABLE, and the response lists both the terms that are not available and the ones that are. - Duplicates are removed and the list is stored sorted, so
[12, 3, 12]is saved as[3, 12].GET /developer/v1/one-time-payment/{id}returns it asallowedTerms.
Months without interest require a credit card. When a payment offers only installment plans, a customer paying with a debit card is asked to use a credit card instead.
Display Modes
Compago supports two display modes for the one-time payment checkout experience.LINK Mode (Default)
In LINK mode, you redirect the customer to theredirectUrl returned by the API. The customer completes the payment on a full-page Compago checkout page and is then redirected back to your redirectUrl with id and externalId query parameters.
This is the simplest integration. Just redirect the customer:
EMBEDDED Mode
In EMBEDDED mode, you embed the checkout URL in an iframe on your own page. This keeps the customer on your site throughout the process. Customize the submit button usingbuttonText and buttonColor.
In EMBEDDED mode, the iframe handles the entire payment flow. Listen for iframe events to react to loading, success, and error states in real time. The iframe never self-redirects — your parent page decides what to render after a successful payment.
Iframe Events (EMBEDDED Mode)
In EMBEDDED mode, the checkout iframe sendspostMessage events to the parent window so you can react without waiting for a redirect.
Events Reference
Listening for Events
Error Codes
Theerror.code field on COMPAGO_ONE_TIME_PAYMENT_ERROR events lets you distinguish failure modes:
Handling the Payment Callback
When a customer successfully completes a payment, Compago redirects them back to yourredirectUrl with two query parameters automatically appended:
id: The Compago one-time payment IDexternalId: The external ID you provided when creating the payment
How the Redirect Works
If you created a payment with:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee, then after the customer completes payment, they’ll be redirected to:
Implementation Example
Here’s how to handle the callback in your application:Best Practices for Callback Handling
Always Verify Payment Status
Always Verify Payment Status
Never trust the redirect alone. Always fetch the payment details from Compago’s API to confirm the status. The redirect happens client-side and could be manipulated.
Handle Missing Query Parameters
Handle Missing Query Parameters
Implement validation to handle cases where query parameters might be missing (user navigating directly to the URL, etc.).
Implement Idempotency
Implement Idempotency
The callback URL might be accessed multiple times (user refreshing page, browser back button). Ensure your fulfillment logic is idempotent.
Use HTTPS for Callback URLs
Use HTTPS for Callback URLs
Always use HTTPS URLs for your
redirectUrl to ensure query parameters are transmitted securely.Preserve Existing Query Parameters
Preserve Existing Query Parameters
If your
redirectUrl already contains query parameters, Compago will append id and externalId to them. Design your callback handler to work with multiple parameters.Security Considerations
Your callback implementation should:- Validate query parameters exist before processing
- Fetch payment status from Compago API - Don’t trust the redirect alone
- Verify the
externalIdmatches your records - Ensure it corresponds to a real order in your system - Check payment status is CONFIRMED before fulfilling the order
- Log all callback attempts for debugging and security monitoring
- Use rate limiting on your callback endpoint to prevent abuse
Testing Your Callback Handler
To test your callback implementation:- Create a one-time payment using your test API key
- Complete the payment in the Compago checkout page
- Verify your callback page receives the
idandexternalIdparameters - Confirm your system correctly fetches and processes the payment status
- Test the failure case by creating a payment and letting it expire
Important Business Rules
Payment Expiration
You can customize the expiration time using thettlMinutes parameter (see Custom Expiration Times below). If your OTP expired and you need to create a new payment for the same transaction, generate a new OTP using a different externalId.
Custom Expiration Times
You can set a custom expiration time for payment links using the optionalttlMinutes parameter. This allows you to create payment links that expire sooner or later based on your business needs.
Configuration:
- Minimum: 10 minutes
- Maximum: 2,880 minutes (48 hours)
- Default: 2,880 minutes (48 hours) if not specified
Flash Sales (Short TTL)
Flash Sales (Short TTL)
For time-sensitive promotions or limited inventory:Use short expiration times (10-60 minutes) to create urgency and ensure inventory isn’t held indefinitely.
Standard Invoices (Default TTL)
Standard Invoices (Default TTL)
For typical invoice payments:The default 48-hour window gives customers plenty of time to complete payment at their convenience.
Event Tickets (Custom TTL)
Event Tickets (Custom TTL)
For event registrations with registration deadlines:Match the TTL to your event registration deadline to automatically close registration.
Quote Acceptance (Extended TTL)
Quote Acceptance (Extended TTL)
For quotes that customers need time to review:Give customers the maximum time to review and approve quotes before they expire.
- Balance security and convenience when setting expiration times
- Shorter TTLs (10-60 min) work well for in-person transactions or time-sensitive offers
- Longer TTLs (12-48 hours) are better for invoices and asynchronous payment flows
- Consider your customer’s payment behavior and typical checkout time
- Communicate the expiration time to customers (e.g., “Complete payment within 30 minutes”)
Minimum Amount
Each Compago account has a configured minimum payment amount. Requests with amounts below this threshold will be rejected with a 400 error. If you receive this error, ensure your payment amount meets your account’s minimum requirement.External ID Uniqueness
TheexternalId must be unique within your organization. Attempting to create a payment with a duplicate externalId will result in a 400 error:
externalId.
Currency Restriction
Currently, only MXN (Mexican Peso) is supported. Requests with other currencies will be rejected.Payment Status
One-time payments have three statuses:- PENDING: Payment link is active and waiting for customer to complete payment
- CONFIRMED: Customer has successfully completed the payment
- CANCELLED: Payment link has been cancelled and can no longer be used
CONFIRMED or CANCELLED, the one-time payment link can no longer be used. See the Cancel One-Time Payment guide to learn how to cancel pending payments.
Retrieving Payment Details
You can retrieve the status and details of a one-time payment using the GET endpoint. Common use case: After receiving a payment callback at yourredirectUrl, use the id query parameter to fetch the payment status and verify completion before fulfilling the order. See Handling the Payment Callback for complete implementation examples.
Endpoint
GET /one-time-payment/{id}
Response for Active Payments
If the payment is stillPENDING and has not expired, you’ll receive full payment details:
Response for Completed or Expired Payments
If the payment is no longerPENDING or has expired, the response will contain limited information:
Supported Mexican States
Use the following state codes in theaddress.state field:
Error Handling
Common Errors
Example Error Response
allowedTerms entry that is not active on your account also carries a code to branch on, and both lists:
Best Practices
- Generate Unique External IDs: Use a combination of order ID and timestamp to ensure uniqueness
- Handle Expiration: Implement logic to create new payment links if the 48-hour window expires
- Validate Amounts: Ensure amounts meet your account’s minimum payment threshold before calling the API
- Store Payment IDs: Save the returned one-time payment ID to track and verify payments later
- Implement Webhooks: Use webhooks (if available) to receive real-time payment status updates
- Test Thoroughly: Use the demo environment to test your integration before going live
- Implement Robust Callback Handling: Always verify payment status in your
redirectUrlcallback by fetching the payment using theidquery parameter. Never assume payment success based on the redirect alone. See Handling the Payment Callback.
Support
If you encounter issues with one-time payments:- Verify your API key is valid in Configuraciones → Desarrollador of the dashboard of the environment you call (Demo or Production), and that you call the host of that same environment
- Ensure all required fields are included in your request
- Check that amounts meet the minimum threshold
- Verify your organization settings are configured correctly
- Contact Compago support at help@compago.com for assistance