premaanshvyas/airwallex-split-payments — explained in plain English
Analysis updated 2026-05-18
Study a working example of splitting one online payment across multiple cards without double charging anyone.
Try the live sandbox demo to see the split-payment checkout flow with test cards.
Read the platform proposal document to understand how a company like Airwallex could price and roll out this feature.
Connect an AI shopping agent to the demo's MCP server to see spending-mandate enforced purchases in action.
Uses Airwallex's sandbox API, so you need sandbox credentials to run it beyond the hosted demo.
This project solves a checkout problem the author ran into personally: they had two separate prepaid gift cards worth a combined amount, but almost no online store lets a shopper pay for one order using two different cards. Physical store registers handle this without any trouble, but online checkout systems are built to accept exactly one card per payment. This repo is a working demonstration, built on the payment company Airwallex's real sandbox environment, of how a checkout could accept two or more cards for a single order. The core piece is an orchestration system that splits one order into several separate authorization requests, one per card, without actually charging any of them yet. Only once every card's hold succeeds does the system charge, or capture, all of them together, so a shopper never ends up with one card charged and the purchase still failing because a second card was declined. If a refund happens, the money is split back across the original cards proportionally, down to the cent. The system also handles edge cases like a shopper refreshing their browser mid checkout, or mixing card networks like Visa and a different network on the same order. A second part of the project is a layer that lets an AI shopping agent make purchases on a person's behalf, spread across multiple funding sources, while a human sets a spending limit that the server enforces rather than trusting the AI agent to respect it on its own. There is also a written proposal document estimating what it would cost Airwallex to offer this as a real feature and outlining a rollout plan. The repo includes a working demo website you can try in a browser with test cards, plus diagrams showing the sequence of API calls between the shopper, the backend, and Airwallex. The author is explicit that this is an independent, unofficial demo project and not an official Airwallex product. The code is released under the MIT license, meaning it can be freely used and modified.
A working demo showing how a checkout could split one payment across two different cards, built on Airwallex's payment API.
Mainly TypeScript. The stack also includes TypeScript, Airwallex API, MCP.
MIT license, free to use, modify, and distribute with attribution.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
double-check against the repo, no cap.