Start purchases
Start a hosted checkout or Payment Sheet purchase flow for a Revenipe product.
After fetching products, your app can start a purchase flow for the selected product.
Revenipe prepares the purchase based on the product, customer, provider, and selected purchase method. Your app then continues with the correct client-side flow.
Before you start
Before starting a purchase, make sure you have:
configured the Revenipe SDK
logged in a customer
fetched or selected a product
created the product in the Revenipe dashboard
connected the product to a billing provider
attached the required entitlements to the product
Purchase methods
Revenipe supports different purchase methods depending on your product and provider setup.
Hosted Checkout
Use hosted checkout when you want Revenipe to create a checkout session and return a checkout URL.
Your app opens the returned URL. After the customer completes checkout, refresh the customer state and check access through Revenipe.
Examplefinal response = await revenipe.startPurchase(
options: MakePurchaseOptions(
productId: 'scartaste_basic_deals',
method: RevenipePurchaseMethod.hostedCheckout,
customerId: customer.customerId,
successUrl: 'https://revenipe.test.com/success',
cancelUrl: 'https://revenipe.test.com/canceled',
),
);If the response contains a checkout URL, open it with your preferred browser flow, deep link flow, or url_launcher setup.
Exampleif (response.checkoutUrl != null) {
// Open the checkout URL.
}Payment Sheet
Use Payment Sheet when you want to present a native payment flow with flutter_stripe.
Revenipe prepares the payment flow and returns the required payment data. Your app then uses the returned data with flutter_stripe to initialize and present the Payment Sheet.
Examplefinal response = await revenipe.startPurchase(
options: MakePurchaseOptions(
productId: '500_credits_pack',
method: RevenipePurchaseMethod.paymentSheet,
customerId: customer.customerId,
),
);After receiving the response, pass the returned Payment Sheet data to flutter_stripe.
The exact fields depend on the response returned by your Revenipe SDK version.
RevenueCat purchases
RevenueCat purchases are handled by the RevenueCat SDK.
Revenipe does not present the RevenueCat purchase screen directly. After the RevenueCat purchase is completed, refresh the Revenipe customer state and read the updated access and entitlement data.
Example// Complete the purchase with the RevenueCat SDK first.
// Then refresh the Revenipe customer state.
await revenipe.login(customerId: customer.customerId);Use Revenipe after the provider-side purchase to read the customer's current access state.
Refresh customer state
After a checkout flow, Payment Sheet flow, trial, add-on purchase, or provider-side purchase is completed, refresh the customer state before unlocking features.
Exampleawait revenipe.login(customerId: customer.customerId);After refreshing the customer state, use entitlement checks or usage values to decide what the customer can access.
Examplefinal hasAccess = revenipe.hasEntitlement('premium_access');Important
Do not unlock access only because a checkout URL was opened, a Payment Sheet was shown, or a provider purchase screen appeared.
Always unlock access based on the customer access state returned by Revenipe after the payment, trial, add-on, or provider state was confirmed.
For Payment Sheet, Revenipe prepares the payment flow, but your app still uses flutter_stripe to present and confirm the native payment sheet.
For RevenueCat, the purchase is handled through RevenueCat. Revenipe is used to refresh and read the customer access state after the purchase.
Next steps
After starting a purchase, check entitlements or track usage to unlock features in your app.