checkout method
- BuildContext context, {
- required Charge charge,
- CheckoutMethod method = CheckoutMethod.selectable,
- bool fullscreen = false,
- Widget? logo,
- bool hideEmail = false,
- bool hideAmount = false,
Make payment using Paystack's checkout form. The plugin will handle the whole processes involved.
context
- the widget's BuildContext
charge
- the charge object.
method
- The payment method to use(card, bank). It defaults to
CheckoutMethod.selectable to allow the user to select. For CheckoutMethod.bank
or CheckoutMethod.selectable, it is
required that you supply an access code to the Charge object passed to charge
.
For CheckoutMethod.card, though not recommended, passing a reference to the
Charge object will do just fine.
Notes:
- You can also pass the PaymentCard object and we'll use it to prepopulate the card fields if card payment is being used
fullscreen
- Whether to display the payment in a full screen dialog or not
logo
- The widget to display at the top left of the payment prompt.
Defaults to an Image widget with Paystack's logo.
hideEmail
- Whether to hide the email from the user. When
false
and an email is passed to the charge
object, the email
will be displayed at the top right edge of the UI prompt. Defaults to
false
hideAmount
- Whether to hide the amount from the payment prompt.
When false
the payment amount and currency is displayed at the
top of payment prompt, just under the email. Also the payment
call-to-action will display the amount, otherwise it will display
"Continue". Defaults to false
Implementation
Future<CheckoutResponse> checkout(
BuildContext context, {
required Charge charge,
CheckoutMethod method = CheckoutMethod.selectable,
bool fullscreen = false,
Widget? logo,
bool hideEmail = false,
bool hideAmount = false,
}) async {
return _Paystack(publicKey).checkout(
context,
charge: charge,
method: method,
fullscreen: fullscreen,
logo: logo,
hideAmount: hideAmount,
hideEmail: hideEmail,
);
}