Skip to content

Commit 56f85df

Browse files
committed
some documentation added
1 parent f2021a2 commit 56f85df

File tree

5 files changed

+273
-257
lines changed

5 files changed

+273
-257
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616
## 0.1.3
1717
* Modified the README.md
1818
* Flutter formats the code [flutter format .]
19+
## 0.1.3
20+
* Modified the README.md
21+
* Added Tokenized API feature
22+
* Changed API of flutter Bkash

README.md

Lines changed: 18 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This will add a line like this to your package's `pubspec.yaml` (and run an impl
2929

3030
```
3131
dependencies:
32-
flutter_bkash: ^0.1.3
32+
flutter_bkash: ^1.0.0
3333
```
3434

3535
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
@@ -51,71 +51,28 @@ Examples for see the `/example` folder.
5151

5252
**Here is the example code**
5353
```
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]
64-
createBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/create',
65-
/// 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]
66-
executeBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/execute',
67-
/// 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)
68-
scriptUrl: 'https://scripts.sandbox.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout-sandbox.js',
69-
/// the return value from the package
70-
/// status => 'paymentSuccess', 'paymentFailed', 'paymentError', 'paymentClose'
71-
/// data => return value of response
72-
73-
paymentStatus: (status, data) {
74-
dev.log('return status => $status');
75-
dev.log('return data => $data');
76-
77-
/// when payment success
78-
if (status == 'paymentSuccess') {
79-
if (data['transactionStatus'] == 'Completed') {
80-
Style.basicToast('Payment Success');
81-
}
82-
}
83-
84-
/// when payment failed
85-
else if (status == 'paymentFailed') {
86-
if (data.isEmpty) {
87-
Style.errorToast('Payment Failed');
88-
} else if (data[0]['errorMessage'].toString() != 'null'){
89-
Style.errorToast("Payment Failed ${data[0]['errorMessage']}");
90-
} else {
91-
Style.errorToast("Payment Failed");
92-
}
93-
}
94-
95-
/// when payment on error
96-
else if (status == 'paymentError') {
97-
Style.errorToast(jsonDecode(data['responseText'])['error']);
98-
}
99-
100-
/// when payment close on demand closed the windows
101-
else if (status == 'paymentClose') {
102-
if (data == 'closedWindow') {
103-
Style.errorToast('Failed to payment, closed screen');
104-
} else if (data == 'scriptLoadedFailed') {
105-
Style.errorToast('Payment screen loading failed');
106-
}
107-
}
108-
/// back to screen to pop()
109-
Navigator.of(context).pop();
110-
},
111-
)
54+
final flutterBkash = FlutterBkash();
55+
56+
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");
68+
}
11269
```
11370

11471
### Importance Notes
11572
- Read the comments in the example of code
11673
- 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.
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. -->
11976

12077

12178
## Contributing

0 commit comments

Comments
 (0)