Replies: 1 comment
-
|
@simmotde This is expected behavior from Google Play Billing Library, not a library issue. What's happening:
From Google Play Billing Library: In react-native-iap (v14.6.0+): interface ProductAndroidOneTimePurchaseOfferDetail {
offerId?: string | null; // ← Optional because base price has no ID
priceCurrencyCode: string;
priceAmountMicros: string;
formattedPrice: string;
// ... other fields
}Why your code needs adjustment: If you're checking const offer = productDetails.oneTimePurchaseOfferDetail;
// ❌ Don't do this:
if (offer.offerId) { /* assume it's a discount */ }
// ✅ Do this instead:
if (offer.offerId) {
console.log('This is a promotional offer:', offer.offerId);
} else {
console.log('This is the base price (no promotional offer)');
}
// Both have valid pricing:
console.log('Price:', offer.formattedPrice); // Works for bothKey takeaway:
This matches Google Play's billing model where base prices don't require offer IDs. 🤖 Generated by gitdog.dev · Have more questions? Tag |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My team is setting up different purchase options for a one time in-app purchase. Each purchase option has different base price and eventually different discounted prices.
When checking the output object of the product, the purchase option without discount has no offer ID:
The purchase option with discount has an offer ID, and inherits the tag of the base price:
From Android documentation, there is no specific mention that this type has no offer ID.
Is this expected that there is no offer ID for the base price purchase option from Google Play?
Beta Was this translation helpful? Give feedback.
All reactions