Question

iOS Payment Sheet not appearing

  • 16 May 2024
  • 2 replies
  • 39 views

Badge

I’m trying to test making a purchase on iOS but the purchasePackage method just hangs and does not resolve or throw and error. 

 

I’m currently using a physicial device with iOS 17.4.1, I’m using capacitor in vue 3 with @revenuecat/purchases-capacitor 7.5.9. My xCode is 15.2.

 

I’m able to get the offerings no problem and pass it to the purchasePackage method but nothing happens, the payment sheet does not appear. I left if for like 10 minutes and it still did not appear or throw an error.

 

Any help would be appreciated 


This post has been closed for comments

2 replies

Userlevel 2
Badge +4

Hi @mitch-596c01! Could you provide debug logs as well as a snippet of your implementation code? Also, are you using a sandbox user or StoreKit (docs)?

Badge

Hey @jeffrey_bunn

Thanks for the reply, there aren’t any error logs when I try and make purchase. I can post all the configure and signing a user in, and getting the offerings if you think that would be helpful. I’m using a sandbox user on a physical device. I tried StoreKit with an emulator but had the same issue.

Here are the code snippets of the implementation:

Created function on the component:

async created() {
if (this.isNativePlatform()) {
try {
this.isLoadingOffering = true;
const offerings = await Purchases.getOfferings();

this.isLoadingOffering = false;

if (offerings.current !== null && offerings.current.availablePackages.length !== 0) {
this.offerings = offerings.current.availablePackages;
this.selectedPackageToBuy = offerings.current.availablePackages[0];
}

await Purchases.addCustomerInfoUpdateListener((customerInfo) => {
this.customerInfo = customerInfo;
});
} catch (error) {
this.isLoadingOffering = false;
}
}
},

 

Make purchase function on the button on click:

 makePurchase() {
console.log('makePurchase');
this.isLoading = true;
Purchases.purchasePackage({ aPackage: this.selectedPackageToBuy })
.then(() => {
console.log('makePurchase then');
this.getUserMethod();
})
.catch((error) => {
console.log('Purchases.purchasePackage error');

console.log(error);
this.isLoading = false;
});
},

The Purchases.purchasePackage function never resolves

!-->