Purchase interceptor
There are many possible cases where you would like to do something right before the user actually makes the purchase, right after he tapped the "Purchase button".
You might want to:
Ask the user to connect or create an account
Ask the user to acknowledge and accept the Terms of use
Make some specific backend check
Check that the content is available in the user geographical zone (media / videos)
Purchasely SDK gives you an opportunity to present or perform something to the user before it actually calls the stores to make the purchase. You can choose to continue the flow or cancel it.

// The handler gives you:
// - the source controller to display something above
// - a closure to notify the completion to the SDK that will proceed (or not) to the purchase
Purchasely.setConfimPurchaseHandler { [weak self](paywallController, processToPayment) in
// Display the terms of use to your user
self?.presentTermsAndConditions(above: paywallController) { (userAcceptedTerms) in
// Don't forget to notify the SDK by calling `processToPayment`
processToPayment(userAcceptedTerms)
}
}
Setup your handler as soon as possible as you app might get opened by a deeplink linking to a paywall.
Last updated
Was this helpful?