Skip to content

Commit a554363

Browse files
committed
modified the README.md, example/lib/main.dart and pubspec.yaml
1 parent abb4829 commit a554363

File tree

3 files changed

+49
-24
lines changed

3 files changed

+49
-24
lines changed

README.md

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)]() [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)]()
1616
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
1717

18-
This is a Flutter package for [bKash](https://www.bkash.com/) BD Payment Gateway. This package can be used in flutter project. We created this package while working for a project and thought to made it release for all so that it helps.
18+
This is a [Flutter package](https://pub.dartlang.org/packages/flutter_bkash) for [bKash](https://www.bkash.com/) BD Payment Gateway. This package can be used in flutter project. We created this package while working for a project and thought to made it release for all so that it helps.
1919

2020
## How to use:
2121

@@ -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.1
32+
flutter_bkash: ^0.1.2
3333
```
3434

3535
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
@@ -42,37 +42,46 @@ import 'package:flutter_bkash/flutter_bkash.dart';
4242
`
4343

4444
## Usage
45-
examples for see the `/example` folder.
45+
46+
Official Link for API documentation and demo checkout
47+
- [bKash API Specifications](https://developer.bka.sh/v1.2.0-beta/reference)
48+
- [bKash Payment Checkout Demo](https://merchantdemo.sandbox.bka.sh/frontend/checkout)
49+
50+
Examples for see the `/example` folder.
4651

4752
**Here is the example code**
4853
```
4954
BkashPayment(
50-
// amount of your bkash payment
51-
amount: '20',
52-
// intent would be (sale / authorization)
53-
intent: 'sale',
54-
// accessToken: '', // if the user have own access token for verify payment
55-
// currency: 'BDT', // bkash url for create payment, when you implement on you project then it be change as your production create url
56-
createBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/create',
57-
// bkash url for execute payment, , when you implement on you project then it be change as your production create url
58-
executeBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/execute',
59-
// for script url, when you implement on production the set it live script js
60-
scriptUrl: 'https://scripts.sandbox.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout-sandbox.js',
61-
62-
// the return value from the package
63-
// status => 'paymentSuccess', 'paymentFailed', 'paymentError', 'paymentClose' // data => return value of response
64-
paymentStatus: (status, data) {
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) {
6574
dev.log('return status => $status');
6675
dev.log('return data => $data');
6776
68-
// when payment success
77+
/// when payment success
6978
if (status == 'paymentSuccess') {
7079
if (data['transactionStatus'] == 'Completed') {
7180
Style.basicToast('Payment Success');
7281
}
7382
}
7483
75-
// when payment failed
84+
/// when payment failed
7685
else if (status == 'paymentFailed') {
7786
if (data.isEmpty) {
7887
Style.errorToast('Payment Failed');
@@ -83,26 +92,41 @@ BkashPayment(
8392
}
8493
}
8594
86-
// when payment on error
95+
/// when payment on error
8796
else if (status == 'paymentError') {
8897
Style.errorToast(jsonDecode(data['responseText'])['error']);
8998
}
9099
91-
// when payment close on demand closed the windows
100+
/// when payment close on demand closed the windows
92101
else if (status == 'paymentClose') {
93102
if (data == 'closedWindow') {
94103
Style.errorToast('Failed to payment, closed screen');
95104
} else if (data == 'scriptLoadedFailed') {
96105
Style.errorToast('Payment screen loading failed');
97106
}
98107
}
99-
// back to screen to pop()
108+
/// back to screen to pop()
100109
Navigator.of(context).pop();
101110
},
102111
)
103112
```
104113

105114
### Importance Notes
106115
- Read the comments in the example of code
116+
- 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)
107117
- **intent** - it would be 'sale' or 'authorization'
108118
- 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+
120+
121+
## Contributing
122+
123+
Contributions to the **flutter_bkash** package are welcome. Please note the following guidelines before submitting your pull request.
124+
125+
- Follow [Effective Dart: Style](https://dart.dev/guides/language/effective-dart/style) coding standards.
126+
- Read bKash API documentations first.Please contact with bKash for their api documentation and sandbox access.
127+
128+
## License
129+
130+
flutter_bkash package is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
131+
132+
Copyright 2022 [Codeboxr.com Team](https://codeboxr.com/team-codeboxr/). We are not affiliated with bKash and don't give any guarantee.

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class HomePageState extends State<HomePage> {
144144
// Goto BkashPayment page & pass the params
145145
Navigator.of(context).push(MaterialPageRoute(
146146
builder: (context) => BkashPayment(
147+
/// depend isSandbox (true/false)
147148
isSandbox: true,
148149
/// amount of your bkash payment
149150
amount: amount,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_bkash
22
description: Flutter package for payment gateway service bKash (Bangladesh). bKash payment easy to implement through this package on your flutter project. # TODO: Description length is between 60 to 180 characters.
3-
version: 0.1.1
3+
version: 0.1.2
44
homepage: https://github.com/codeboxrcodehub/flutter-bkash
55

66
environment:

0 commit comments

Comments
 (0)