juicyway_flutter 1.3.0
juicyway_flutter: ^1.3.0 copied to clipboard
Official Juicyway Flutter SDK
Official Juicyway Flutter SDK
Introduction #
JuicywayCheckoutView integrates Juicyway checkout into Flutter apps via a modal WebView wrapper around the Juicyway checkout URL.
Screen Shots #
Installation #
Add the dependency:
dependencies:
juicyway_flutter: ^1.3.0 # or the latest compatible version from pub.dev
Then run:
flutter pub get
Usage #
Import the package:
import 'package:juicyway_flutter/juicyway_flutter.dart';
Example #
const options = JuicyWayChekoutOptions(
amount: 6000,
currency: JuicyWayCurrency.USD,
environment: JuicyWayEnvironment.production,
accountId: 'YOUR_ACCOUNT_ID',
key: 'YOUR_KEY',
customer: JuicywayCustomer(
billingAddress: JuicywayBillingAddress(
city: 'Ikeja',
countryCode: 'NG',
line1: 'Sample Address here...',
state: 'Lagos',
zipCode: '101251',
),
email: 'test@example.com',
firstName: 'John',
lastName: 'Doe',
phoneNumber: '+234...........',
),
paymentMethod: PaymentMethod.card,
);
await JuicywayCheckoutView(
options: options,
showLogs: true,
onClosed: () {
print('closed');
Navigator.pop(context);
},
onSuccess: (data) {
print(data.toString());
Navigator.pop(context);
},
onError: print,
).show(context);
Checkout options (JuicyWayChekoutOptions) #
Set environment to JuicyWayEnvironment.sandbox, JuicyWayEnvironment.staging, or JuicyWayEnvironment.production for the Juicyway environment you are targeting.
Required fields typically include amount, key, paymentMethod, and customer / account identifiers as required by your integration.
Widget parameters (JuicywayCheckoutView) #
-
options:JuicyWayChekoutOptionsfor the checkout session. -
showLogs(optional): Log WebView/checkout activity. Defaults tofalse. -
onClosed(optional): Called when the checkout UI is dismissed. -
onSuccess(optional): Called on a successful payment; receives the payload from the checkout flow. -
onError(optional): Called when an error is reported during checkout.
Additional resources #
See Juicyway documentation and this package’s API docs on pub.dev for the latest types and callbacks.