Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shurjopay-plugins/sp-plugin-flutter
shurjoPay plugin SDK for Flutter apps
https://github.com/shurjopay-plugins/sp-plugin-flutter
dart flutter shurjomukhi shurjopay
Last synced: about 1 month ago
JSON representation
shurjoPay plugin SDK for Flutter apps
- Host: GitHub
- URL: https://github.com/shurjopay-plugins/sp-plugin-flutter
- Owner: shurjopay-plugins
- License: mit
- Created: 2022-09-27T06:22:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T05:15:51.000Z (10 months ago)
- Last Synced: 2024-02-28T06:26:27.407Z (10 months ago)
- Topics: dart, flutter, shurjomukhi, shurjopay
- Language: Dart
- Homepage:
- Size: 404 KB
- Stars: 22
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## shurjoPay flutter package
This is the official **shurjoPay** flutter package for merchants or service providers to integrate our payment system with their Flutter applications. For now, it only supports **Android and iOS**.
**shurjoPay** flutter package makes the payment system easier for you with just two method calls:
- `makePayment()`
- `verifyPayment()`And that's all! To know more about its usage please check the details below.
## Adding a package dependency to an app
1. Open the ```pubspec.yaml``` file located inside the app folder and add ```shurjopay: ^2.0.5``` under dependencies.
2. Run command ```flutter pub get``` to pull and download dependencies.## Usage
- First, you must initialize shurjoPay before using it by calling `initializeShurjopay()` and passing the environment type as a parameter.
**Example:**
```dart
void main() {
initializeShurjopay(environment: "sandbox");
runApp(const MyApp());
}
```- After that, you can start using our package the way you want based on your application. Here we are providing a basic example code snip for you.
**Example**
```dart
//Create a shurjoPay object.
ShurjoPay shurjoPay = ShurjoPay();//Create payment request model and initialize values.
ShurjopayRequestModel shurjopayRequestModel = ShurjopayRequestModel(
// Create ShurjopayConfigs object somewhere and set values in it, so that you can pass it here.
configs: shurjopayConfigs,
currency: "BDT",
amount: 1000,
//Remember to use prefix before order id. Ex: if prefix is 'test' then order id should be test123456
orderID: "sp1ab2c3d4",
discountAmount: 0,
discountPercentage: 0,
customerName: "Shajedul Islam",
customerPhoneNumber: "01628734916",
customerAddress: "customer address",
customerCity: "customer city",
customerPostcode: "1212",
returnURL: "return_url",
cancelURL: "cancel_url",
);//Create a payment response model object to store the makePayment() method results.
ShurjopayResponseModel shurjopayResponseModel = ShurjopayResponseModel();//Calling makePayment() method to initiate payment process.
shurjopayResponseModel = await shurjoPay.makePayment(
context: context,
shurjopayRequestModel: shurjopayRequestModel,
);//Create a verification response model object to store the verifyPayment() method results
ShurjopayVerificationModel shurjopayVerificationModel = ShurjopayVerificationModel();//If the status is true from makePayment() method result then, verify the payment by calling verifyPayment() method whenever you want.
if (shurjopayResponseModel.status == true) {
try {
shurjopayVerificationModel = await shurjoPay.verifyPayment(
orderID: shurjopayResponseModel.shurjopayOrderID!,
);
if (shurjopayVerificationModel.spCode == "1000") {
print("Payment Varified");
}
} catch (error) {
print(error.toString());
}
}
```
That's all! Now you are ready to use our shurjoPay flutter package to make your payment system easy and smooth.## License
This code is under the [MIT open source License](http://www.opensource.org/licenses/mit-license.php).
#### Please [contact](https://shurjopay.com.bd/#contacts) with shurjoPay team for more detail.
Copyright ©️2023 [ShurjoMukhi Limited](https://shurjomukhi.com.bd).