wowpay_flutter 1.0.2 copy "wowpay_flutter: ^1.0.2" to clipboard
wowpay_flutter: ^1.0.2 copied to clipboard

Flutter starter kit for kick-starting off your projects

Flutter Standard SDK

Prerequisites Create a Wowpay Account. Generate API Keys in Dashboard. Once you are done with the integration, you can generate Live Mode API keys and replace them in the integration. Integration Steps Follow these steps to integrate your Flutter application with the Flutter Payment Gateway:

Install the Wowpay Flutter SDK Add the Dependencies Import Package Create Razorpay instance Attach Event Listeners Open Checkout Step 1: Install Wowpay Flutter SDK Install the SDK using the following npm command in the Terminal window. If you are using Windows, please use Git Bash instead of Command Prompt window. Ensure that you run this code within your React Native project folder in Terminal window. $ flutter pub add wowpay-flutter Step 2: Add the Dependencies Add the below code to dependencies in your app's pubspec.yaml wowpay-flutter: 1.0.0

Get Packages Run flutter packages get in the root directory of your app. Update android/build.gradle Update minSdkVersion to 19 or higher

Step 3: Import Package Use the below code to import the wowpay_flutter.dart file to your project. import 'package:wowpay_flutter/wowpay_flutter.dart'; Step 4: Create Wowpay instance _wowpay = Wowpay(options); Options sample: { "api_key": "7ef94cfb04a3dcab4e79febe36b0b0bf", "amount": 50000, "user_id":"10", "currency": "MYR", "order_id": "Test000014", "customer": { "title": "Mr", "first_name": "Thong", "last_name": "Tran", "mobile": "+84989452008", "email": "humgthongit@gmail.com", "customer_type": "Adult", "islead_pax": true, "address": "Nam thanh", "city": "Kuala Lumpur", "postcode": "548010", "country": "MY", }, "order_info": { "item_list": [ { "item_amount": 25.98, "item_code": "code", "item_desc": " It has a lightweight, breathable mesh upper with orefootcables for a locked-down fit.", "item_id": 1, "item_name": "Nike Flex Form TR Women's Sneaker", "item_type": 0, } ], "order_desc": "Test payment", } }

Step 5: Attach Event Listeners The plugin uses event-based communication and emits events when payments fail or succeed. The event names are exposed via the constants EVENT_PAYMENT_SUCCESS, EVENT_PAYMENT_ERROR from the Wowpay class. Use the on(String event, Function handler) method on the Wowpay instance to attach event listeners. _razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess); _razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError); The handlers would be defined in the class as: void _handlePaymentSuccess(PaymentSuccessResponse response) { // Do something when payment succeeds }

void _handlePaymentError(PaymentFailureResponse response) { // Do something when payment fails} To clear event listeners, use the clear method on the Wowpay instance. _wowpay.clear(); // Removes all listeners

Step 6: Open Checkout follow type card _wowpay.open(typecard); TypeCard { CreditCard="CreditCard", eWallet="eWallet", FPX="OnlineBanking", } Sample _wowpay.open(TypeCard.CreditCard);