Available Payment Methods
PixelTech Colombia supports multiple payment gateways to provide flexible payment options for your customers:MercadoPago
Credit/debit cards and digital wallets
ADDI
Buy now, pay later financing
Sistecrédito
Credit financing solutions
Payment Flow Overview
All payment gateways follow a consistent flow:Common Order Lifecycle
All payment gateways create orders with the following status flow:Order Statuses
| Status | Description |
|---|---|
PENDIENTE_PAGO | Order created, awaiting payment |
PAGADO | Payment approved and confirmed |
RECHAZADO | Payment rejected or cancelled |
Payment Statuses
| Status | Description |
|---|---|
PENDING | Payment initiated but not completed |
PAID | Payment successfully completed |
Order Data Structure
All payment gateways create orders in Firestore with this structure:Webhook Handling
All payment gateways use webhooks to notify your system of payment status changes. The webhook flow is consistent:Webhook Security
- All webhooks validate the payment status by querying the gateway API
- Never trust client-side data alone
- Use transactions to prevent race conditions
Webhook Actions
When a payment is approved, webhooks automatically:- Validate order exists - Check if the order hasn’t already been processed
- Deduct inventory - Reduce stock for ordered products and variants
- Update treasury - Add payment to the linked account balance
- Create income record - Log transaction in expenses collection
- Generate remission - Create fulfillment document for warehouse
- Update order status - Mark order as PAGADO with payment details
Duplicate Prevention
All webhooks include duplicate detection:Stock Management
All payment gateways handle inventory deduction with support for:- Simple products - Direct stock reduction
- Product variants - Stock reduction by color/capacity combination
- Atomic transactions - Prevents overselling
Treasury Integration
Payments are automatically recorded in the treasury system:Account Linking
Each payment gateway can be linked to a treasury account using thegatewayLink field:
- MercadoPago →
gatewayLink: 'MERCADOPAGO' - ADDI →
gatewayLink: 'ADDI' - Sistecrédito →
gatewayLink: 'SISTECREDITO'
isDefaultOnline: true.
Income Recording
Every successful payment creates an income record:Error Handling
All payment functions include comprehensive error handling:Authentication Errors
Validation Errors
Gateway Errors
Testing Payments
Development Mode
Each gateway supports sandbox/testing modes:- MercadoPago: Use test access token
- ADDI: Set
IS_SANDBOX = true(uses api.addi-staging.com) - Sistecrédito: Set
IS_SC_SANDBOX = true
Test Flow
- Create a test order with real product IDs from your database
- Use test credentials for the payment gateway
- Complete payment in sandbox environment
- Verify webhook receives notification
- Check order status updates to PAGADO
- Confirm stock was deducted
- Verify treasury balance increased
Test Data Requirements
Firebase authentication token for the test user
Array of products with valid IDs from your products collection
Complete buyer information including name, email, phone, and address
Best Practices
Security
Security
- Always validate prices on the server by querying the products collection
- Never trust client-submitted prices
- Use Firebase Authentication for all checkout requests
- Validate webhook payloads by querying the gateway API
User Experience
User Experience
- Set payment expiration times (MercadoPago: 30 minutes)
- Provide clear error messages
- Redirect users to appropriate success/failure pages
- Send confirmation emails after successful payment
Data Integrity
Data Integrity
- Use Firestore transactions for all stock updates
- Implement duplicate webhook detection
- Set
isStockDeductedflag to prevent double deduction - Log all webhook events for debugging
Monitoring
Monitoring
- Log all payment creation attempts
- Monitor webhook response times
- Track failed payments and reasons
- Alert on unusual error rates
Next Steps
Configure MercadoPago
Set up credit card payments
Add ADDI Financing
Enable buy now, pay later
Configure Sistecrédito
Add credit financing
Treasury Setup
Configure payment accounts