Hello everyone,
I’d like to ask for your input regarding best practices for implementing In-App Purchases (IAP) across both the frontend and backend.
Here’s our current flow:
-Frontend (Mobile)
- The user opens a specific page.
- We initiate a payment request using react-native-iap.
- After the user completes the payment, we send the purchase data (receipt) to our backend.
Backend:
- Accept the purchase receipt from the app.
- Validate the receipt with Apple’s server. (GET https://api.storekit.itunes.apple.com/inApps/v1/transactions/{transactionId})
- If the receipt is valid and the response indicates success, we mark the payment status as PAID.
- We store the transaction ID in our payment module.
The Issue:
- We recently encountered a situation where Apple returned a valid receipt, so we marked the transaction as PAID. However, later we realized that the payment status was actually Pending.
{
transactionId: '70002676245699',
originalTransactionId: '70002676245639',
bundleId: '',
productId: '',
purchaseDate: 1745560404000,
originalPurchaseDate: 1745560404000,
quantity: 1,
type: 'Consumable',
inAppOwnershipType: 'PURCHASED',
signedDate: 1745981078460,
environment: 'Production',
transactionReason: 'PURCHASE',
storefront: 'SGP',
storefrontId: '',
price: 5000,
currency: 'SGD',
appTransactionId: ''
}
This raised a few questions:
- Does a Pending status always resolve to Paid, or is there a risk that Apple may later mark it as Failed or Unpaid?
- Is there a specific field in Apple's receipt response that reliably indicates whether the purchase is truly active?
- Should we hold off on granting access or product delivery until the status transitions from Pending to Paid?
We’d really appreciate any insights or recommendations on how to handle this edge case to avoid granting access prematurely.
Thanks in advance!