One credit ledger across App Store, Google Play, and Stripe
How I approached a shared entitlement model for native purchases and Stripe checkout while keeping each payment provider's lifecycle intact.
A credit pack sounds simple. A customer buys it, and the application adds credits to a balance. The product decision looks the same on a phone and on the web. What counts as a verified purchase depends on where it was made.
At Hauler Network, I worked on a reusable purchase layer for StoreKit and Google Play Billing in the Expo app, alongside Stripe on the web. The goal was to give the customer one view of their credits while letting each provider keep its transaction identity. The first native credit-pack flow was built for a test-account pilot. Here is the engineering pattern I would carry into another project.
Keep provider details at the edge
The mobile layer opens the purchase flow appropriate to the platform and reports the result. The backend verifies the purchase against its origin and resolves the product and beneficiary before granting any credits. The catalog can have a shared product concept even when the store identifiers differ.
| Responsibility | What it owns |
|---|---|
| Checkout | The interaction and purchase identifiers for that provider. |
| Verification | Whether the provider confirms the purchase and which product it represents. |
| Entitlement | How many credits to grant and which account or workspace receives them. |
| Ledger | The record of the grant and whether it has already been applied. |
Keeping the billing origin is useful for support and reconciliation. A customer can recognize one balance in the app, and an engineer can still trace a credit grant to the transaction that produced it.
Design for a confirmation to arrive twice
Imagine a customer buys a 100-credit pack on a phone. The device sends the purchase for verification, the server grants the credits, and the network drops before the response reaches the device. When the device retries, the customer should see the same successful outcome and a balance increased by exactly 100 credits.
I handle that by tying the grant to the verified provider transaction and making the ledger entry unique for that purchase. The user-facing operation can return its existing result on retry. A pending or unverified purchase earns zero credits. The same goes for a purchase that belongs to a different beneficiary.
That gives me a concrete test matrix. I can retry the same confirmation, interrupt the device between purchase and sync, or submit a purchase under the wrong account. In each case I can compare the ledger entries and the balance with what the customer sees.
Treat reconciliation as part of the rollout
Normal checkout only exercises one path. Before broader enablement, I want evidence for what happens when a payment settles late, a store callback arrives after the device retries, or a refund needs reconciliation. Each provider has its own events and lifecycle, and those differences belong in the provider integration.
I would reuse the same three questions on another project. Who verified the purchase? Who is entitled to the result? Has the ledger already granted it? Answers to those questions keep the purchase flow understandable on web and mobile even when the order of events changes.