Skip to content

Commit 04b71cb

Browse files
committed
update the README.md and pubspec.yaml
1 parent 7733ac2 commit 04b71cb

File tree

2 files changed

+83
-14
lines changed

2 files changed

+83
-14
lines changed

README.md

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,95 @@
1212

1313
[![Pub](https://img.shields.io/pub/v/flutter_bkash.svg)](https://pub.dartlang.org/packages/flutter_bkash)
1414
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
15+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)]() [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)]()
16+
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
1517

16-
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 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.
1719

18-
## Features
20+
## How to use:
1921

20-
List what your package can do. Maybe include images, gifs, or videos.
22+
Depend on it, Run this command With Flutter:
2123

22-
## Getting started
24+
```
25+
$ flutter pub add flutter_bkash
26+
```
2327

24-
List prerequisites and provide or point to information on how to
25-
start using the package.
28+
This will add a line like this to your package's `pubspec.yaml` (and run an implicit **`flutter pub get`**):
2629

27-
## Usage
30+
```
31+
dependencies:
32+
flutter_bkash: ^0.1.0
33+
```
34+
35+
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
36+
Import it
37+
38+
Now in your Dart code, you can use:
2839

29-
Include short and useful examples for package users. Add longer examples
30-
to `/example` folder.
40+
`
41+
import 'package:flutter_bkash/flutter_bkash.dart';
42+
`
43+
44+
## Usage
45+
examples for see the `/example` folder.
3146

47+
**Here is the example code**
48+
```
49+
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 createBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/create',
56+
// bkash url for execute payment, , when you implement on you project then it be change as your production create url
57+
executeBKashUrl: 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/execute',
58+
// for script url, when you implement on production the set it live script js
59+
scriptUrl: 'https://scripts.sandbox.bka.sh/versions/1.2.0-beta/checkout/bKash-checkout-sandbox.js',
60+
61+
// the return value from the package
62+
// status => 'paymentSuccess', 'paymentFailed', 'paymentError', 'paymentClose' // data => return value of response paymentStatus: (status, data) {
63+
dev.log('return status => $status');
64+
dev.log('return data => $data');
3265
33-
## Additional information
66+
// when payment success
67+
if (status == 'paymentSuccess') {
68+
if (data['transactionStatus'] == 'Completed') {
69+
Style.basicToast('Payment Success');
70+
}
71+
}
72+
73+
// when payment failed
74+
else if (status == 'paymentFailed') {
75+
if (data.isEmpty) {
76+
Style.errorToast('Payment Failed');
77+
} else if (data[0]['errorMessage'].toString() != 'null'){
78+
Style.errorToast("Payment Failed ${data[0]['errorMessage']}");
79+
} else {
80+
Style.errorToast("Payment Failed");
81+
}
82+
}
83+
84+
// when payment on error
85+
else if (status == 'paymentError') {
86+
Style.errorToast(jsonDecode(data['responseText'])['error']);
87+
}
88+
89+
// when payment close on demand closed the windows
90+
else if (status == 'paymentClose') {
91+
if (data == 'closedWindow') {
92+
Style.errorToast('Failed to payment, closed screen');
93+
} else if (data == 'scriptLoadedFailed') {
94+
Style.errorToast('Payment screen loading failed');
95+
}
96+
}
97+
// back to screen to pop()
98+
Navigator.of(context).pop();
99+
},
100+
)
101+
```
34102

35-
Tell users more about the package: where to find more information, how to
36-
contribute to the package, how to file issues, what response they can expect
37-
from the package authors, and more.
103+
### Importance Notes
104+
- Read the comments in the example of code
105+
- **intent** - it would be 'sale' or 'authorization'
106+
- 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.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: flutter_bkash
2-
description: Flutter package for payment gateway bKash (Bangladesh). # TODO: Description length is between 60 to 180 characters.
2+
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.
33
version: 0.1.0
44
homepage: https://github.com/codeboxrcodehub/flutter-bkash
55

0 commit comments

Comments
 (0)