Skip to content

Best practice to implementation IAP in frontend & backend side #2948

@HariisV

Description

@HariisV

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)

  1. The user opens a specific page.
  2. We initiate a payment request using react-native-iap.
  3. After the user completes the payment, we send the purchase data (receipt) to our backend.

Backend

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: ''
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❓ questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions