Payments
Payments
Overview
Endpoints
POST /v2/payments
Request Body
{
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"name": "Professional Consulting Services",
"description": "Monthly consulting retainer for business strategy",
"quantity": 1,
"total": 1500,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"currency": "MXN",
"metadata": {
"reference": "REF456789"
}
}
💡 Amount Handling: Item total
amounts are specified in regular currency units (e.g., 1500 = $15.00 MXN). The API automatically converts these to cents for internal processing, so the responseamount
will be 150000 (cents).
{
"client": {
"name": "Maria Rodriguez Santos",
"email": "maria.rodriguez@example.com",
"rfc": "ROSM850315QT8",
"legal_name": "MARIA RODRIGUEZ SANTOS",
"tax_system": "601",
"address": {
"zip": "06100",
"country": "MEX"
},
"use": "G01"
},
"items": [
{
"name": "Monthly Software License",
"description": "Premium SaaS subscription",
"quantity": 1,
"total": 1500,
"product_key": "43232408",
"unit_key": "E48",
"unit_name": "Unidad de servicio",
"taxes": [
{
"type": "IVA",
"rate": 0.16,
"factor": "Tasa"
}
]
}
],
"currency": "MXN",
"automaticInvoice": true,
"avoidEmail": false,
"livemode": false,
"metadata": {
"internalId": "INV-2024-001",
"reference": "Monthly subscription"
}
}
{
"team": "team_9ZwE3pF8qKmJ7xL",
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"name": "Development Services",
"description": "Custom software development for sub-team",
"quantity": 1,
"total": 5000,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"currency": "MXN",
"automaticInvoice": true,
"metadata": {
"internalId": "MASTER-SUB-001",
"masterTeamPayment": "true"
}
}
{
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"name": "Marketplace Transaction",
"description": "Commission-based service",
"quantity": 1,
"total": 10000,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"currency": "MXN",
"automaticInvoice": true,
"metadata": {
"vendor_id": "team_connectPartner123",
"marketplace_transaction": "true"
}
}
{
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"name": "Completed Project",
"description": "Website development project",
"quantity": 1,
"total": 25000,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"paid": true,
"paymentMethod": "01",
"date": "2024-01-15T10:30:00Z",
"automaticInvoice": true,
"metadata": {
"projectId": "PROJ-2024-001"
}
}
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
clientId | string | No* | Client identifier (required if client object not provided) |
client | object | No* | Client information object (alternative to clientId) |
email | string | No | Client email (alternative to client.email) |
items | array | Yes | Array of payment items (amounts in regular currency units, not cents) |
team | string | No | Target team ID (master teams only - creates payment for specified team) |
currency | string | No | Currency code: MXN, USD, EUR (default: MXN) |
exchange | number | No | Exchange rate (auto-calculated if not provided) |
paymentMethod | string | No* | Payment method code (required if paid is true) |
paid | boolean | No | Whether the payment is already paid (default: false) |
date | string | No | Payment date in ISO format (defaults to current date) |
livemode | boolean | No | Whether payment is in live mode (default: false) |
avoidEmail | boolean | No | Skip email notifications (default: false) |
automaticInvoice | boolean | No | Auto-create invoice on payment (default: false) |
automateInvoiceOnComplete | boolean | No | Auto-create invoice when completed (default: false) |
automateIncomeInvoiceAndComplement | boolean | No | Auto PPD invoice and complement (default: false) |
forceReceipt | boolean | No | Force receipt creation (default: false) |
invoiceConfig | object | No | Invoice configuration (folio, series, type) |
from | string | No | Payment source identifier (default: "api") |
metadata | object | No | Additional payment metadata |
clientId
or client
object is required.Response
{
"data": {
"id": "paymentB8M3K7NQWX",
"fid": "paymentB8M3K7NQWX",
"team": "team_9ZwE3pF8qKmJ7xL",
"owner": "5TVadmQLPkh134vuqr892ntHbrS1",
"billingAccount": "ba_xzpRdFw2KSmVtQm",
"amount": 150000,
"currency": "MXN",
"status": "requires_payment_method",
"internalStatus": "requires_payment_method",
"client": {
"id": "client_7kL2mX9pNqR4eWs",
"name": "Maria Rodriguez Santos",
"email": "maria.rodriguez@example.com",
"rfc": "ROSM850315QT8",
"legal_name": "MARIA RODRIGUEZ SANTOS",
"tax_system": "601",
"address": {
"zip": "06100",
"country": "MEX"
},
"use": "G01",
"livemode": true,
"timestamp": 1745892357421
},
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"id": "serviceR6TYNMQWXZ",
"name": "Professional Consulting Services",
"description": "Monthly consulting retainer for business strategy",
"quantity": 3,
"total": 450,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio",
"taxes": [],
"discount": 0,
"currency": "MXN",
"paymentType": {
"label": "Tarifa fija",
"value": "fixed"
}
}
],
"discount": 0,
"exchange": 1,
"payment_form": "01",
"processor": "api",
"custom_method_types": [
{
"name": "Transferencia bancaria",
"id": "bank",
"logo": "https://pro-gigstack.s3.us-east-2.amazonaws.com/icons/+bank.png",
"details": "Pago con transferencia desde tu cuenta bancaria",
"manualConfirmation": true
},
{
"name": "Tarjeta de crédito o débito",
"id": "card",
"logo": "https://pro-gigstack.s3.us-east-2.amazonaws.com/icons/Cards2.svg",
"details": "Pago con tarjeta de crédito o débito",
"manualConfirmation": false,
"requiredKey": "paymentIntent"
},
{
"name": "OXXO",
"id": "oxxo",
"logo": "https://js.stripe.com/v3/fingerprinted/img/oxxo-96b6ab36d23607973cb466bec56d187b.svg",
"details": "Pago en efectivo en tiendas OXXO",
"manualConfirmation": false,
"requiredKey": "paymentIntent"
}
],
"automations": [
{
"action": "create",
"ref": "payments",
"type": "invoice",
"from": "payments"
}
],
"invoices": [],
"metadata": {
"internalID": "paymentB8M3K7NQWX",
"owner": "5TVadmQLPkh134vuqr892ntHbrS1",
"items": 1
},
"from": "api",
"timestamp": 1748236547821,
"created": 1748236547821,
"succeededTimestamp": null,
"livemode": false,
"shortURL": "https://gigstack.xyz/paymentB8M3K7NQWX",
"shortUrl": "https://gigstack.xyz/paymentB8M3K7NQWX",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"hasStripe": false,
"paymentIntent": "pi_Q34KLMRVX8HGAS52G792MN4P",
"client_secret": "pi_Q34KLMRVX8HGAS52G792MN4P_secret_...",
"stripeGenerated": true,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
},
"oxxo": {
"expires_after_days": 3
}
}
},
"message": "Pago registrado correctamente",
"next": null
}
GET /v2/payments
Query Parameters
Parameter | Type | Description |
---|---|---|
limit | number | Number of results to return (default: 10, max: 100) |
starting_after | string | Cursor for pagination, ID of the item to start after |
order_by | string | Field to order results by (default: timestamp) |
order_direction | string | Direction to order results: asc or desc (default: desc) |
amount | number | Filter by amount |
status | string | Filter by payment status |
clientId | string | Filter by client ID |
rfc | string | Filter by client RFC |
Response
{
"data": [
{
"id": "paymentB8M3K7NQWX",
"amount": 150000,
"status": "completed",
"clientId": "client_7kL2mX9pNqR4eWs",
"currency": "MXN",
"timestamp": 1748236547821,
"client": {
"name": "Maria Rodriguez Santos",
"rfc": "ROSM850315QT8"
},
"shortURL": "https://gigstack.xyz/paymentB8M3K7NQWX"
}
],
"message": "Payments retrieved successfully",
"totalResults": 1,
"hasMore": false,
"next": null
}
GET /v2/payments/{paymentId}
Response
Master Team Features
Master Team Payment Creation
isMasterTeam: true
) can create payments on behalf of other teams within their billing account using the team
parameter.isMasterTeam: true
{
"team": "team_subsidiary123",
"clientId": "client_7kL2mX9pNqR4eWs",
"items": [
{
"name": "Services for Subsidiary",
"description": "Monthly consulting services",
"quantity": 1,
"total": 2500,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"automaticInvoice": true,
"metadata": {
"masterTeamPayment": "true",
"internalId": "MASTER-SUB-001"
}
}
Split Billing / Connect Platform
Configuration Requirements
split_billing: true
- Enables split billingsplit_amount: 10
- Percentage kept by master team (e.g., 10%)metadata_split_keys: ["vendor_id", "vendor_code"]
- Metadata keys that trigger split billingsplit_billing_type: "client"
- Client resolution for master team ("client", "master", "connect")split_billing_type_connect: "client"
- Client resolution for connect team ("client", "master", "connect")How Split Billing Works
1.
metadata_split_keys
array2.
metadata.vendor_id = "team_abc123"
→ Direct document lookupmetadata.vendor_code = "ABC123"
→ Query teams where team.metadata.vendor_code = "ABC123"
3.
connectPaymentsHub
collection (not regular payments
)4.
transfer_data
object with split detailsClient Resolution
"client"
: Use original payment client"master"
: Use master team as client"connect"
: Use connected team as clientExample Split Billing Payment
{
"clientId": "client_customer123",
"items": [
{
"name": "Marketplace Service",
"description": "Commission-based transaction",
"quantity": 1,
"total": 10000,
"product_key": "84111506",
"unit_key": "E48",
"unit_name": "Unidad de servicio"
}
],
"currency": "MXN",
"metadata": {
"vendor_id": "team_vendor456",
"transaction_type": "marketplace"
}
}
{
"data": {
"id": "paymentXYZ123",
"amount": 1000000,
"transfer_data": {
"destination": "team_vendor456",
"split": 90,
"splitType": {
"master": "client",
"connect": "client"
}
}
// ... rest of payment object
}
}
Security Features
Payment Status
Status | Description |
---|---|
requires_payment_method | Payment is awaiting payment method |
requires_confirmation | Payment requires confirmation |
requires_action | Payment requires additional action |
processing | Payment is being processed |
requires_capture | Payment requires manual capture |
canceled | Payment was canceled |
succeeded | Payment has been successfully completed |
Payment Methods
paid: true
, you must specify a paymentMethod
using one of these SAT-compliant codes:Code | Description |
---|---|
01 | Efectivo (Cash) |
02 | Cheque nominativo |
03 | Transferencia electrónica de fondos |
04 | Tarjeta de crédito |
05 | Monedero electrónico |
06 | Dinero electrónico |
08 | Vales de despensa |
12 | Dación en pago |
13 | Pago por subrogación |
14 | Pago por consignación |
15 | Condonación |
17 | Compensación |
23 | Novación |
24 | Confusión |
25 | Remisión de deuda |
26 | Prescripción o caducidad |
27 | A satisfacción del acreedor |
28 | Tarjeta de débito |
29 | Tarjeta de servicios |
30 | Aplicación de anticipos |
31 | Intermediario pagos |
99 | Por definir |
Currency Support
Payment Response Fields
Core Fields
id
: Unique payment identifieramount
: Payment amount in cents (e.g., 150000 = $1,500.00 MXN)currency
: Payment currency (MXN, USD, etc.)status
: Current payment statusclientId
: Associated client IDtimestamp
: Payment creation timestamp⚠️ Important: The response amount
is always in cents, while request itemtotal
values are in regular currency units. The API handles the conversion automatically.
Client Information
client
: Complete client object using unified Client schemaUnified Client Schema
name
: Client display nameemail
: Client email addressrfc
: Mexican tax ID (RFC)legal_name
: Legal business nametax_system
: Tax system code (SAT catalog)address
: Complete address objectuse
: CFDI use codephone
: Client phone number (optional)id
: Unique client identifierbillingAccount
: Associated billing account IDmetadata
: Additional client metadataowner
: Owner user IDfrom
: Client creation source (api, dashboard, etc.)team
: Associated team IDtimestamp
: Client creation timestamplivemode
: Whether client is in live modezip
: Legacy postal code field (use address.zip instead){
"id": "clientFG4T78PIPLYZ",
"billingAccount": "ba_uubHbCv9TRkWxOr",
"metadata": {
"internalId": "f3e28c9b",
"reference": "REF-20240615-1"
},
"owner": "8UWdgXELUhf022vuoq249mtGytG2",
"email": "maria.lopez@gmail.com",
"from": "api",
"team": "team_1IqJPJdcwTV2xTI",
"name": "María López",
"rfc": "LOPM850612AB2",
"legal_name": "Servicios Integrales López S.A. de C.V.",
"timestamp": 1750018281145,
"livemode": false,
"tax_system": "601",
"address": {
"city": "Ciudad de México",
"country": "México",
"street": "Av. Insurgentes Sur 1234",
"zip": "03100",
"state": "CDMX"
},
"phone": "+52 55 1234 5678",
"use": "G01"
}
Payment Items
items
: Array of services/products being paid forPayment Methods
custom_method_types
: Available payment methods (card, bank transfer, OXXO)paymentIntent
: Stripe payment intent IDclient_secret
: Stripe client secret for frontend integrationURLs and Tokens
shortURL
: Shareable payment linktoken
: JWT token for payment accessCode Examples
Create a Payment
💰 Amount Note: In the examples below, item total
values (1500, 12500, etc.) are in regular currency units. The API response will show these amounts multiplied by 100 in theamount
field (e.g., 1500 → 150000 cents).
💰 Amount Note: Item total
values in the examples are in regular currency units (e.g., 1500 = $15.00). The API automatically converts these to cents in the response (1500 → 150000).
List Payments with Filtering
Error Handling
Common Error Responses
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": {
"amount": "Amount must be greater than 0",
"clientId": "Client ID is required"
}
},
"message": "Request validation failed"
}
{
"error": {
"code": "NOT_FOUND",
"message": "Payment not found"
},
"message": "The requested payment does not exist"
}
Automation Features
Invoice Automation
automaticInvoice
: Creates an invoice immediately when payment is createdautomateInvoiceOnComplete
: Creates an invoice when payment status becomes "succeeded"automateIncomeInvoiceAndComplement
: Creates a PPD (Por Pagar/Por Definir) invoice and payment complement (cannot be combined with paid: true
or paymentMethod
)Email Automation
avoidEmail
: Prevents automatic email notifications to clientsReceipt Automation
forceReceipt
: Forces creation of a receipt document regardless of other settingsValidation Rules
Required Fields
items
: At least one item is requiredclientId
OR client
: Either reference an existing client or provide client informationpaymentMethod
: Required when paid: true
Client Validation
Item Validation
Business Rules
automateIncomeInvoiceAndComplement
with paid: true
automateIncomeInvoiceAndComplement
with paymentMethod
metadata.internalId
prevention within team scopeMaster Team Rules
isMasterTeam: true
can use the team
parametermetadata.internalId
prevention applies to target team scopeSplit Billing Rules
Best Practices
1.
clientId
for existing clients, client
object for new clients2.
3.
4.
5.
6.
7.
metadata.internalId
for unique payment tracking across systems8.
9.
10.
Stripe Integration
paymentIntent
: Stripe Payment Intent IDclient_secret
: Use with Stripe.js for frontend payment processingpayment_method_options
: Configured payment method optionsWebhooks
{
"event": "payment.succeeded",
"data": {
"id": "paymentB8M3K7NQWX",
"amount": 150000,
"status": "succeeded",
"clientId": "client_7kL2mX9pNqR4eWs",
"timestamp": 1748236547821
}
}
Next Steps
Modified at 2025-06-16 03:36:15