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,107 +19,135 @@ 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: ^0.1.3
29
+
flutter_bkash: ^0.2.0
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.
> Make sure to replace the provided credentials with your own bKash sandbox or production credentials depending on your development environment.
64
+
65
+
### Pay without Agreement
66
+
To make a payment without an agreement, use the `pay` method:
67
+
68
+
***Request***
69
+
```
70
+
final result = await flutterBkash.pay(
71
+
context: context, // BuildContext context
72
+
amount: 100.0, // amount as double
73
+
merchantInvoiceNumber: "invoice123",
74
+
);
75
+
```
76
+
***Response***
77
+
```
78
+
BkashPaymentResponse(
79
+
trxId: AFI60BAC94,
80
+
payerReference: ,
81
+
paymentId: TR0011fd4uZMS1687062024354,
82
+
customerMsisdn: 01877722345,
83
+
merchantInvoiceNumber: tranId,
84
+
_executeTime: 2023-06-18T10:22:31:623 GMT+0600
85
+
)
86
+
```
87
+
### Create Agreement
88
+
To create a new agreement, use the `createAgreement` method:
51
89
52
-
**Here is the example code**
53
-
```
54
-
BkashPayment(
55
-
// depend isSandbox (true/false)
56
-
isSandbox: true,
57
-
// amount of your bkash payment
58
-
amount: '20',
59
-
/// intent would be (sale / authorization)
60
-
intent: 'sale',
61
-
// accessToken: '', /// if the user have own access token for verify payment
62
-
// currency: 'BDT',
63
-
/// bkash url for create payment, when you implement on you project then it be change as your production create url, [when you send it on sandbox mode, send it as empty string '' or anything]
/// bkash url for execute payment, , when you implement on you project then it be change as your production create url, [when you send it on sandbox mode, send it as empty string '' or anything]
/// for script url, when you implement on production the set it live script js (https://scripts.pay.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout-pay.js)
To make a payment with an existing agreement, use the `payWithAgreement` method:
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
+
```
130
+
try {
131
+
// Make a payment or create an agreement
132
+
} on BkashFailure catch (e) {
133
+
// Handle the error
134
+
print(e.message);
135
+
}
136
+
```
137
+
138
+
Examples for see the `/example` folder.
139
+
140
+
**Here is the example code**[link](https://github.com/codeboxrcodehub/flutter-bkash/blob/master/example/lib/main.dart)
113
141
114
142
### Importance Notes
115
143
- Read the comments in the example of code
116
144
- 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)
117
-
-**intent** - it would be 'sale' or 'authorization'
118
-
- 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.
119
145
120
146
121
147
## Contributing
148
+
**Core Maintainer**
149
+
-[Md Riadul Islam](https://github.com/rdnasim)
150
+
-[ABDULLAH AL MASUM](https://github.com/dev-masum)
122
151
123
152
Contributions to the **flutter_bkash** package are welcome. Please note the following guidelines before submitting your pull request.
124
153
@@ -129,4 +158,4 @@ Contributions to the **flutter_bkash** package are welcome. Please note the foll
129
158
130
159
flutter_bkash package is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
131
160
132
-
Copyright 2022[Codeboxr.com Team](https://codeboxr.com/team-codeboxr/). We are not affiliated with bKash and don't give any guarantee.
161
+
Copyright 2023[Codeboxr.com Team](https://codeboxr.com/team-codeboxr/). We are not affiliated with bKash and don't give any guarantee.
0 commit comments