This method will be called just before the payment gets created, and lets you decide whether you want to proceed with the payment creation.
⚠️
This method will be called only when using the PrimerPaymentHandling.AUTO
flow.
Please note, that if you override
this method, you must call one of the decisionHandler's methods.
1234
fun onBeforePaymentCreated( paymentMethodData: PrimerPaymentMethodData, decisionHandler: PrimerPaymentCreationDecisionHandler)
kotlin
copy
Parameters
paymentMethodDataRequired
paymentMethodTypeStringRequired
A unique string identifier for the payment method. (e.g. PAYPAL
, GOOGLE_PAY
)
decisionHandlerPrimerPaymentCreationDecisionHandlerRequired
Methods
continuePaymentCreation()
Call continuePaymentCreation()
when you want to continue with the payment creation.
abortPaymentCreation(errorMessage)
Call abortPaymentCreation(errorMessage)
when you want to abort the payment. Optionally you can provide an error message to get presented on the error screen.
Example
123456789101112
class CheckoutActivity : AppCompatActivity() { // 👇 Add this private val listener = object : PrimerCheckoutListener { // 👇 Add this override fun onBeforePaymentCreated( paymentMethodData: PrimerPaymentMethodData, decisionHandler: PrimerPaymentCreationDecisionHandler ) { decisionHandler.continuePaymentCreation() } } }
kotlin
copy