RevenueCat / RevenueCat/react-native-purchases

Purchases.getOfferings() returning different object on Android vs iOS

Open
#727 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
117
Avg merge
14h 40m
Merged PRs (30d)
40

Description

Describe the bug
I was able to get my offerings as follows:

Purchases.getOfferings()
      .then((offerings) => {
        console.log('offerings:', offerings);

        if (offerings?.current.availablePackages.length !== 0) {
          return this.setState({
            offerings: offerings?.current?.availablePackages,
          });
        }

        return this.setState({ offerings: false });
      })
      .catch((error) =>
        console.log('error getting offerings:', error),
      );

However, the elements inside the availablePackages array are different in Android vs. on iOS.

Is this intended? I didn't find anything related to this in the docs.
What could I be doing wrong?

  1. Environment
    1. Platform: iOS/ Android
    2. SDK version: "react-native-purchases": "^6.3.0",
    3. OS version: latest
    4. React Native version: 0.72.2
    5. How widespread is the issue. Percentage of devices affected - Local only

availablePackages item on ios:

{
            "packageType": "MONTHLY",
            "identifier": "$rc_monthly",
            "product": {
                "priceString": "$3.49",
                "productType": "NON_CONSUMABLE",
                "discounts": [],
                "description": "Enjoy the all-access \"Plus\" version",
                "currencyCode": "USD",
                "title": "....",
                "price": 3.4899999999999998,
                "subscriptionPeriod": "P1M",
                "productCategory": "SUBSCRIPTION",
                "identifier": "....plus.1month",
                "introPrice": {
                    "cycles": 1,
                    "periodUnit": "DAY",
                    "priceString": "$0.00",
                    "period": "P3D",
                    "periodNumberOfUnits": 3,
                    "price": 0
                }
            },
            "offeringIdentifier": "default"
        },

vs android

{
            "offeringIdentifier": "default",
            "product": {
                "presentedOfferingIdentifier": "default",
                "subscriptionOptions": [
                    {
                        "introPhase": null,
                        "freePhase": null,
                        "isPrepaid": false,
                        "presentedOfferingIdentifier": "default",
                        "fullPricePhase": {
                            "offerPaymentMode": null,
                            "billingCycleCount": 0,
                            "price": {
                                "currencyCode": "EUR",
                                "amountMicros": 3990000,
                                "formatted": "€3.99"
                            },
                            "recurrenceMode": 1,
                            "billingPeriod": {
                                "iso8601": "P1M",
                                "value": 1,
                                "unit": "MONTH"
                            }
                        },
                        "isBasePlan": true,
                        "billingPeriod": {
                            "iso8601": "P1M",
                            "value": 1,
                            "unit": "MONTH"
                        },
                        "productId": "....plus.1month",
                        "tags": [],
                        "pricingPhases": [
                            {
                                "offerPaymentMode": null,
                                "billingCycleCount": 0,
                                "price": {
                                    "currencyCode": "EUR",
                                    "amountMicros": 3990000,
                                    "formatted": "€3.99"
                                },
                                "recurrenceMode": 1,
                                "billingPeriod": {
                                    "iso8601": "P1M",
                                    "value": 1,
                                    "unit": "MONTH"
                                }
                            }
                        ],
                        "storeProductId": "....plus.1month:p1m",
                        "id": "p1m"
                    }
                ],
                "introPrice": null,
                "currencyCode": "EUR",
                "priceString": "€3.99",
                "subscriptionPeriod": "P1M",
                "productCategory": "SUBSCRIPTION",
                "price": 3.99,
                "title": "",
                "productType": "AUTO_RENEWABLE_SUBSCRIPTION",
                "discounts": null,
                "defaultOption": {
                    "introPhase": null,
                    "freePhase": null,
                    "isPrepaid": false,
                    "presentedOfferingIdentifier": "default",
                    "fullPricePhase": {
                        "offerPaymentMode": null,
                        "billingCycleCount": 0,
                        "price": {
                            "currencyCode": "EUR",
                            "amountMicros": 3990000,
                            "formatted": "€3.99"
                        },
                        "recurrenceMode": 1,
                        "billingPeriod": {
                            "iso8601": "P1M",
                            "value": 1,
                            "unit": "MONTH"
                        }
                    },
                    "isBasePlan": true,
                    "billingPeriod": {
                        "iso8601": "P1M",
                        "value": 1,
                        "unit": "MONTH"
                    },
                    "productId": "....plus.1month",
                    "tags": [],
                    "pricingPhases": [
                        {
                            "offerPaymentMode": null,
                            "billingCycleCount": 0,
                            "price": {
                                "currencyCode": "EUR",
                                "amountMicros": 3990000,
                                "formatted": "€3.99"
                            },
                            "recurrenceMode": 1,
                            "billingPeriod": {
                                "iso8601": "P1M",
                                "value": 1,
                                "unit": "MONTH"
                            }
                        }
                    ],
                    "storeProductId": "....plus.1month:p1m",
                    "id": "p1m"
                },
                "description": "...!",
                "identifier": "....plus.1month:p1m"
            },
            "packageType": "MONTHLY",
            "identifier": "$rc_monthly"
        },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Purchases.getOfferings() and compare the availablePackages payloads shown for iOS and Android. Determine whether the platform-specific object shapes are intended, then document the expected result or define the compatibility change needed; no source file or test is identified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.