You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h1align="center">bKash(BD) Mobile Finance Payment Gateway Flutter Package</h1>
@@ -18,61 +19,132 @@ This is a [Flutter package](https://pub.dartlang.org/packages/flutter_bkash) for
18
19
19
20
Check the package in <atarget="_blank"href="https://github.com/codeboxrcodehub/flutter-bkash"rel="noopener">github</a> and also available in <ahref="https://pub.dartlang.org/packages/flutter_bkash"rel="noopener nofollow"target="_blank">flutter/dart package</a>
20
21
## How to use:
21
-
22
22
Depend on it, Run this command With Flutter:
23
-
24
23
```
25
24
$ flutter pub add flutter_bkash
26
25
```
27
-
28
26
This will add a line like this to your package's `pubspec.yaml` (and run an implicit **`flutter pub get`**):
29
-
30
27
```
31
28
dependencies:
32
-
flutter_bkash: ^1.0.0
29
+
flutter_bkash: ^0.1.3
30
+
```
31
+
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more. Import it, Now in your Dart code, you can use:
33
32
```
34
-
35
-
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
To make a payment with an existing agreement, use the `payWithAgreement` method:
55
106
107
+
***Request***
108
+
```
109
+
final result = await flutterBkash.payWithAgreement(
110
+
context: context, // BuildContext context
111
+
amount: 100.0, // type as double
112
+
agreementId: "agreement123",
113
+
merchantInvoiceNumber: "invoice123",
114
+
);
115
+
```
116
+
***Response***
117
+
```
118
+
BkashPaymentResponse(
119
+
trxId: AFI60BAC94,
120
+
payerReference: ,
121
+
paymentId: TR0011fd4uZMS1687062024354,
122
+
customerMsisdn: 01877722345,
123
+
merchantInvoiceNumber: tranId,
124
+
_executeTime: 2023-06-18T10:22:31:623 GMT+0600
125
+
)
126
+
```
127
+
### Error Handling
128
+
The methods mentioned above may throw a `BkashFailure` exception in case of an error. You can catch and handle the exception using a try-catch block:
129
+
```
56
130
try {
57
-
final bkashPaymentResponse = await flutterBkash.pay(
58
-
context: context,
59
-
amount: double.parse(amount),
60
-
marchentInvoiceNumber: "tranId",
61
-
);
62
-
63
-
print(bkashPaymentResponse);
64
-
} on BkashFailure catch (e, st) {
65
-
print(e.message, error: e, stackTrace: st);
66
-
} catch (e) {
67
-
print("Something went wrong");
131
+
// Make a payment or create an agreement
132
+
} on BkashFailure catch (e) {
133
+
// Handle the error
134
+
print(e.message);
68
135
}
69
136
```
70
137
138
+
Examples for see the `/example` folder.
139
+
140
+
**Here is the example code**
141
+
```
142
+
Example Code implement here.
143
+
```
144
+
71
145
### Importance Notes
72
146
- Read the comments in the example of code
73
147
- See the documents and demo checkout [bKash API Specifications](https://developer.bka.sh/v1.2.0-beta/reference), [bKash Payment Checkout Demo](https://merchantdemo.sandbox.bka.sh/frontend/checkout)
74
-
<!-- - **intent** - it would be 'sale' or 'authorization' -->
75
-
<!-- - Payment status return as 'paymentSuccess', 'paymentFailed', 'paymentError', 'paymentClose', find on this keyword of the payment status, then you get the data of response on specific status. -->
76
148
77
149
78
150
## Contributing
@@ -86,4 +158,4 @@ Contributions to the **flutter_bkash** package are welcome. Please note the foll
86
158
87
159
flutter_bkash package is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
88
160
89
-
Copyright 2022 [Codeboxr.com Team](https://codeboxr.com/team-codeboxr/). We are not affiliated with bKash and don't give any guarantee.
0 commit comments