Gateway migration strategy: 1) Run both gateways in parallel — new transactions go to the new gateway, old webhook handlers stay active for legacy transactions. 2) Migrate one-time checkout first — it is stateless, easiest to validate. 3) For subscriptions: let existing subscriptions run on the old gateway until they cancel or expire; new signups go to the new gateway. 4) Stored card authorizations cannot be migrated — customers must re-enter card details on the new gateway. 5) Keep the old gateway's webhook endpoint active for 90 days after cutover to catch late-arriving events.
| Phase | Action | Duration | Rollback? |
|---|---|---|---|
| 1. Preparation | Build and test new gateway integration in staging; set up new webhook endpoint | 1-2 weeks | N/A (not live yet) |
| 2. Soft launch | Route 5-10% of new checkouts to new gateway; keep old gateway as default | 1 week | Yes — flip routing back |
| 3. Ramp up | Increase new gateway traffic to 50%, then 100% for new checkouts | 1-2 weeks | Yes — flip routing back |
| 4. Subscriptions | Route new subscription sign-ups to new gateway; existing on old gateway | Ongoing — subscriptions decay naturally | Partial — new subs on old gateway |
| 5. Old gateway cleanup | Keep old webhook handler active 90 days; then decommission | 3 months post-cutover | No (but old gateway account stays open) |
// Routing logic during migration (store in DB or env var)
var GATEWAY_ROUTING = {
new_checkouts: 'new_gateway', // flip this progressively
new_subscriptions: 'new_gateway',
existing_subscriptions: 'old_gateway', // never change this — tokens are gateway-specific
};
async function getGatewayForRequest(type, customerId) {
if (type === 'subscription_renewal') {
// Always use the gateway this customer's subscription is on
var subscription = await db.subscriptions.findByCustomer(customerId);
return subscription.gateway; // 'old_gateway' or 'new_gateway'
}
return GATEWAY_ROUTING[type] || 'new_gateway';
}
See building a payment provider abstraction layer — the prerequisite that makes parallel running feasible.
KES 2,999
The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.
Start Paystack Course