Skip to main content
Question

Redirect after successful purchase

  • 10 November 2023
  • 1 reply
  • 66 views

Forum|alt.badge.img+1

I would like to redirect the user in the App upon a successful purchase.

```

const purchaseResult = await Purchases.purchaseStoreProduct({

product: productToBuy

});

```

How/where would I call this redirect?

1 reply

Michael Fogel
Forum|alt.badge.img+6
  • Dedicated Contributor
  • 382 replies
  • November 14, 2023

Hey @paul-098e37 !

 

You will want to tap into the customerInfo object to verify a successful purchase. The purchase(package:) completion block will contain an updated CustomerInfo object if successful, along with some details about the transaction. If the error object is present, then the purchase failed. See our guide on Error Handling for the specific error types. The userCancelled boolean is a helper for handling user cancellation errors. There will still be an error object if the user cancels, but you can optionally check the boolean instead of unwrapping the error completely.

 

Let me know if that helps! 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings