Skip to content

await Purchases.purchasePackage() doesn't return but the payment is successful. #521

Description

@rubby-c

I followed the docs on https://www.revenuecat.com/docs/making-purchases but I'm experiencing a strange issue.
Here's my code:

const offerings = await Purchases.getOfferings();
const result = offerings.current.availablePackages[0];
const { customerInfo } = await Purchases.purchasePackage(result);

console.log('After purchase:', customerInfo);

if (typeof customerInfo.entitlements.active.premium !== 'undefined') {
    //  Successful purchase code.
}

The payment goes through but Purchases.purchasePackage() never returns so the code afterwards isn't executed.

I added an event handler to listen for customer info updates and it works fine but using it instead of the code above complicates things in my server implementation.

Purchases.addCustomerInfoUpdateListener((info) => {
    console.log('Customer info update:', info)
});

Any suggestions on how to make it work?

Edit: I'm using a real Android device and my app is on the internal testing google play track. Purchases are in test-mode with a test card.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions