The SDK has a simple method, `purchase(package:)`, that takes a package from the fetched Offering and purchases the underlying product with Apple, Google, or Amazon.

ο»Ώ

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.

Warning: Automatic Transaction Finishing/Acknowledgement/Consumption

Transactions (new and previous transactions that are synced) will be automatically finished (acknowledged and consumed in Android), and will be made available through the RevenueCat SDK / Dashboard / ETL Exports.

You can use [observer mode](πŸ”—ο»Ώ) if you don't wish to have transactions finished (or consumed, in Android) automatically, but you will have to make sure that you finish/consume them yourself.

## Next Steps

  • Don't forget to provide some way for customers to [restore their purchases ο»Ώο»Ώ](πŸ”—ο»Ώ)ο»Ώ

  • With purchases coming through, make sure they're [linked to the correct user Id ο»Ώο»Ώ](πŸ”—ο»Ώ)ο»Ώ

  • If you're ready to test, start with our guides on [sandbox testing ο»Ώο»Ώ](πŸ”—ο»Ώ)ο»Ώ