-
-
Notifications
You must be signed in to change notification settings - Fork 684
Open
Labels
❓ questionFurther information is requestedFurther information is requested
Description
In-App Purchases (IAP) Best Practices
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.
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.
Example of receipt:
{
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: ''
}eden170
Metadata
Metadata
Assignees
Labels
❓ questionFurther information is requestedFurther information is requested