How to migrate existing credit balances to a new checkout
The checkout changes. The balances do not. Import every entitlement with its source, freeze grants during the switch and reconcile a test cohort first.
Migrating credit balances to a new checkout is an entitlement move, not a payment move. The balances live in your application; the checkout only creates new purchases. The work is to import every existing balance with its source and terms, freeze grants during the switch so nothing double-grants, reconcile a test cohort before the full cutover, and keep the old records readable afterward. Done in that order, customers notice nothing except that the buy button works. Done carelessly, they notice either a missing balance or a doubled one, and both are expensive to unwind.
Separate the three things people call "migration"
A checkout switch mixes three distinct moves, and each has its own failure modes:
- The purchase path. Where buyers pay from now on. This is the checkout change itself: new sessions, new webhook, same ledger. Check that the new route saves each order and returns a reference your app can match before any grant.
- The entitlement state. The balances, active periods and saved allocations your app currently honors. This is the migration proper, and it moves by import, not by payment.
- The open obligations. Paid-but-undelivered purchases, active prepaid periods, invoices awaiting payment on the old route. These do not migrate; they are honored under the old records until they resolve.
Teams that conflate the three end up re-purchasing entitlements that already existed, or worse, re-collecting for purchases the customer already made. The old route's open obligations in particular need care: a customer who paid on the old checkout last week does not owe the new checkout anything, and treating their balance as "not migrated yet" is how refund demands start.
Inventory every entitlement before you touch anything
- Export the current state. Every account's balance, active period end dates, saved allocations between workspaces, and the source of each: which purchase, which date, which terms version.
- Classify the sources. Purchased credits, promotional grants, support corrections. Each may carry different terms (expiry, transferability) that the import must preserve.
- List the open obligations. Every paid-but-undelivered purchase on the old route, every invoice sent but unpaid, every prepaid period still running.
- Decide the cutover moment. The point after which new purchases go to the new checkout and the entitlement table is frozen against direct writes.
The export is the migration's source of truth. If your old system cannot produce a clean export of balances with sources, build that export first, from the ledger rather than from a snapshot of current balances: a snapshot tells you what each account has, but not why, and the why is what the import must preserve. Promotional credits with an expiry date imported without their expiry become permanent; that error is invisible on day one and expensive at support scale later.
Run the import in the right order
| Step | Action | Verification |
|---|---|---|
| 1 | Freeze entitlement writes (no new grants, no direct balance edits) | The ledger's write log shows nothing after the freeze timestamp |
| 2 | Import balances and periods with their source records | Row count matches the export; spot-check ten accounts against the old system |
| 3 | Import open obligations with their original purchase references | Each open obligation links to a real old-route purchase |
| 4 | Reconcile a test cohort end to end | A handful of accounts, checked by a person who did not run the import |
| 5 | Point new purchases at the new checkout | One live purchase traced from order to grant to wallet receipt |
| 6 | Unfreeze and monitor | Daily balance-change anomaly scan for the first week |
The freeze in step 1 is the step teams skip and regret. During the import window, any purchase on the old route that completes would grant credits against a table mid-import. Freeze first, import second, and if the old route must stay open during the freeze, queue its confirmations for delivery after the unfreeze rather than writing during the import.
The test cohort in step 4 is the other one. Pick accounts at the edges: the largest balance, the smallest, one with a promotional grant, one with an active period ending soon, one with an open old-route obligation. A person who did not run the import checks each against the old records. Ten minutes of checking finds the systematic errors (expiry dropped, workspaces mis-mapped) that a full-scale launch would find for you, publicly.
Keep purchases and imports in different lanes
After cutover, two kinds of balance changes exist and they must never merge:
- Purchases. Created by the new checkout, verified by webhook, granted once. The verification guide covers the checks, and the credit ledger guide covers the grant-once rule.
- Imports. Created once by the migration script, tagged with the import batch, immune to the purchase path.
Tag every imported balance change with its batch. When a customer later asks why their balance looks different, the ledger answers from the tagged entry instead of support reconstructing history from memory. If you need to correct an import error after cutover, correct it as a new ledger entry referencing the batch, never by editing the original: the correction should identify the affected workspace and reason.
Handle the old route's leftovers deliberately
- Paid-but-undelivered purchases. Deliver them from the old records; the new checkout owes nothing. Resume the original grant, as in handling pending payments in an AI checkout.
- Unpaid invoices. Still owed, still payable per their terms. Do not re-issue under the new route with new numbering; the original invoice reference is what the buyer's accounts payable will match.
- Active prepaid periods. Honor the end dates purchased on the old route. The renewal, when it comes, happens on the new route; the customer should receive the correct invoice or purchase terms for that next period.
- Unresolved payment attempts. Verify each against the old provider's records before classifying. A checkout switch is not evidence an old attempt failed.
Keep the old records accessible for as long as disputes and questions can arrive, which for card payments is a long window. Agree with your finance and privacy owners which records must remain accessible and under what retention schedule.
Document the migration in your checkout record
Railbed maintains checkouts.md, the open format for documenting an agent-built checkout. Record the migration like any other checkout event: the cutover timestamp, the import batch reference, the verification steps performed and the name of who checked the test cohort. A dated record turns the next migration, or the next developer, into a reader rather than an archaeologist. See documenting payments for AI agents for the format.
Decide whether the ledger needs to move at all
If the current credit ledger belongs to your app and works independently of the old payment provider, keep it. Add the new route's verified payment to the same grant process only for new orders. That is less work than exporting a correct ledger and replacing it with a new one. A migration is necessary when the old billing system is also the source of balances or when you're moving the app to a different storage model. Treat those as separate releases when possible so you can tell which change caused any discrepancy.
| Starting point | What to keep | What to change | Main check |
|---|---|---|---|
| App already owns a reliable ledger | History, balances and spend rules | New payment-to-order connection | One verified order creates one grant |
| Billing system owns balances | Readable export and original purchase evidence | Import the entitlement into the app's records | Units and terms agree per workspace |
| Several systems disagree | Each source's dated records and exceptions | Reconcile first; import only the approved state | No unresolved discrepancy is overwritten |
| Active service periods have no credit balance | Paid coverage dates and scope | Select the future billing path | Existing access ends on the agreed date |
Give each field an owner. Finance knows which purchases were paid; the application team knows the units used; customer support knows whether an exception was promised and authorized. A good export includes status, units and terms, but it won't resolve a customer promise nobody recorded. Work through those exceptions before writing a batch that assumes every account follows the default.
Worked reconciliation: preserve balances and terms
Consider a fictional design tool with an account that bought 120 units, used 35 and received 10 promotional units that expire separately. The account has 95 units available at the snapshot: 85 purchased and 10 promotional. An import that writes one undifferentiated grant for 95 reconciles to a balance at the time of the snapshot but loses the separate expiry. An import that writes 120 purchased units without capturing the usage grants the customer 35 extra. The type of record you copy matters as much as the total.
Now add a second account whose 40 available units sit alongside a reservation for 15 units still attached to a running job. Confirm what “available” means in the export. If the available number already excludes reservations, subtracting the reservation again would cut availability to 25. If you choose to let the existing job finish before the snapshot, record the result and take a new snapshot. If you migrate an active reservation instead, map its job reference and verify that completion consumes it once and failure releases it once.
Suppose a third account appears in the export twice because the business changed its email address. Use stable customer and workspace identifiers to prove that both rows belong to the same destination before combining them. Someone belonging to two workspaces might have the same email in both but own different entitlements. Treat ambiguous mappings as exceptions. Leave the original account record readable until an authorized person can settle who owns the balance.
Build a dry run that proves more than a total
- Use a consistent checkpoint. Export the ledger and open payment obligations against the same boundary, or record a way to account for activity as the exports finish. Save the original file and the processing version under your internal access rules. An export circulated in chat is not an appropriate place for real customer data.
- Map fields and meanings before importing. Specify which field is the stable workspace key, what a blank expiry means, and which units are reserved, available or used. Decide whether fractional units are allowed and how rounding works under the original terms. Reject a source row with missing ownership rather than assigning it a convenient default.
- Run the same dry import twice. The second run should not grant anything again. Use a durable batch and source entry reference, not the timestamp of the last run alone. Inspect any partial failure to see whether you can resume the rejected rows without touching prior successes.
- Compare accounts, not just sums. Check totals by workspace and grant type. Compare paid terms and expiry separately. A credit incorrectly moved from one workspace to another could leave the grand total unchanged. Have someone who didn't write the import check cases from the old system as well as the new one.
- Check buyer-visible state. Confirm that an account holder can see the agreed units, coverage and useful history without reading internal batch identifiers. Make sure the support view can trace the same balance to the import and original record. Those two views serve different roles, but they should describe the same purchase.
Establish a cutoff for new sales, not for old obligations
Before changing the Buy button, mark the cutoff you will apply to new orders. Keep the order's payment route at the attempt level so a legitimate confirmation that arrives late still belongs to the route that collected it. Do not tag an old order as a new-route order merely because the state changes after the cutoff. Leave event processing available where appropriate and queue legitimate delivery work during any pause, with each reference and recovery status recorded.
The freeze should be scoped to what the migration requires. If you pause only purchased grants but customers can spend credits while you export, reconcile the usage since the snapshot before treating balances as final. If you pause the entire entitlement ledger, plan how already running jobs finish and tell customers what will happen. During either approach, take care not to promise instant access to purchases that will sit in a recoverable queue until the import completes.
A rollback plan also needs an owner. Before new purchases begin, a rejected dry run can typically be discarded in the isolated environment. After verified new sales and usage exist, restoring an old snapshot can erase those events. Keep the post-cutover records, stop new payment requests on the affected path when appropriate, and resolve the differences instead of discarding real purchases. For a missing grant, support should be able to check the original payment without asking the customer to pay again.
Put the first morning's support cases in the runbook
Write down who handles wrong workspace assignments, missing promotional terms and payments still unresolved on the old route. The first useful response should acknowledge the specific order and say what the team is checking. If you intend to preserve expiries, support should be able to find the original date instead of estimating it from the import time. If the customer was still in a paid period, show the agreed end date even when the future payment link is new.
For an AI tool that issues units and paid access, pick one order you can trace through both records; Railbed for AI tools explains the supported purchase formats. Record how the next teammate can locate the old and new evidence. The important handoff is not that a job completed, but that its results can be checked by someone who wasn't there.
Verify the migration again after the first expiry and billing event
A correct balance at cutover does not prove that tomorrow's changes will be correct. Schedule an internal check after the first imported grant expires or the first reserved job resolves. Compare the change with the original rules. If a customer had both purchased and promotional units, confirm the application spent from the intended source before calculating the expiry. The order of those operations can determine whether the customer loses units it already bought. Keep the evidence with the batch rather than adding a manual balance change to hide the discrepancy.
Take a fictional paid workspace that still has 14 days of access at cutover. When the account next receives an invoice, compare the saved coverage dates with the app's existing entitlement. The new invoice is for a separate period. Sending it does not cancel those 14 days or prove collection for what comes next. When the customer pays, check the verified payment and update the agreed interval once. If the same account buys additional credits independently, the grant should leave the coverage dates alone.
For an old order that resolves after cutover, have operations run a second check against both routes. An after-cutoff confirmation can be entirely legitimate. Match it using the original order and check whether a reservation, manual adjustment or earlier delivery already covered it. If the customer made a second payment on the new route, preserve both payment records and resolve the duplicate through the business's approved policy. Do not let either worker infer that a refund is due solely because it sees an order from the other system.
Prepare a customer message for a real discrepancy
When you have verified an error, tell the customer what happened to their own purchase, what was restored and where they can see it. If you're still investigating, distinguish paid purchases from unsettled attempts, and give the customer a next update your staff can actually meet. Avoid promising that every older purchase imported correctly if the team checked only a sample. Give support a private way to report a pattern affecting more accounts so an individual fix can trigger a broader reconciliation rather than another invisible correction.
FAQ
Do customer balances change when we switch checkout?
No. Balances are application records. The migration imports them unchanged, with their sources and terms preserved.
What happens to purchases made on the old checkout just before cutover?
They are honored from the old records. Verify the payment, resume the original delivery, and never ask the customer to repurchase.
How do we prevent double-granting during the switch?
Freeze entitlement writes during the import window, then tag imports separately from purchases so the two paths never merge.
What if a balance is wrong after migration?
Trace the account's ledger entries against the export. Correct with a new entry referencing the import batch; do not edit the original import record.
Do promotional credits migrate with their expiry?
Only if the export carried it. Classify sources before import and preserve each source's terms, or promotional credits silently become permanent.
Should we re-issue unpaid old invoices in the new system?
No. The original invoice reference is what accounts payable will match. Keep the old invoice open and collect against it.
How long should we keep the old checkout records?
As long as card disputes and purchase questions can arrive. Access matters more than duration; the records need to be readable, not just stored.
Last updated 4 December 2026.