Understanding Multi-Method Flow
The fallback logic works by creating a prioritized list of payment methods and attempting each one until a transaction succeeds. This approach ensures that if a customer’s preferred payment method fails (due to insufficient funds, card declined, or technical issues), your system automatically tries alternative methods without requiring the customer to manually select a different option. The fallback logic works by creating a prioritized list of payment methods and attempting each one until a transaction succeeds:Fallback Flow Summary
The multi-method payment flow follows these key steps:- Start with the customer’s preferred payment method and call the Tonder API.
- Check the payment response status - if successful or pending, complete the transaction.
- If the payment fails or is declined, check if alternative payment methods are available.
- If more methods exist, automatically try the next method in your priority list.
- If all methods have been exhausted, show an error message to the customer.
- Handle the final result - either process the successful payment or inform the customer of failure.
Step 1: Define Your Fallback Strategy
Plan your payment method priority order. A typical fallback sequence might be:- Card: The most common and immediate method.
- SPEI: A reliable alternative, especially for larger amounts.
- OXXO: A final fallback for users who may not have a bank account or card.
Implementation FlexibilityThe fallback logic shown in this guide is just one example approach. You’re free to implement your own custom strategy based on your business needs, such as:
- Different priority orders for different customer segments
- Conditional fallbacks based on transaction amount
- Geographic or regulatory considerations
- User preference-driven fallback selection
Step 2: Implement the Fallback Loop
Create a function that tries each payment method sequentially until one succeeds. This implementation:- Defines a prioritized list of payment methods (CARD, SPEI, OXXO Pay).
- Attempts each method in order until one succeeds.
- Handles both API failures and payment declines gracefully.
- Returns the successful transaction response or raises an exception if all methods fail.
- Includes proper logging for debugging and monitoring.
Next Steps
- Review individual payment method guides to understand each method’s specific requirements.
- Set up webhooks to handle asynchronous payment status updates.
- Implement error handling to gracefully manage payment failures.
- Test different scenarios using testing data to validate your fallback logic.

