vanilla_pay_international

Creator: coderz1093

Last updated:

0 purchases

vanilla_pay_international Image
vanilla_pay_international Images
Add to Cart

Description:

vanilla pay international

Vanilla Pay International Dart Package #
With this module, developers can effortlessly integrate Vanilla Pay International's payment service into their cross-platform Flutter applications.
Introduction #
The Vanilla Pay International Dart package provides a convenient way to integrate Vanilla Pay International services into your Flutter applications (Android & iOs). It allows you to generate tokens, initialize payments, check transaction statuses, and validate data authenticity with ease.
Installation #
To use this package, add vanilla_pay_international as a dependency in your pubspec.yaml file:
dependencies:
vanilla_pay_international: ^1.0.0
copied to clipboard
Then, run flutter pub get to install the package.
Usage #
Initialize Payment Manager #
To use the Vanilla Pay International services, you need to initialize a PaymentManager instance:
import 'package:vanilla_pay_international/vanilla_pay_international.dart';

void main() {
PaymentManager paymentManager = PaymentManager(
env: 'PROD',
vpiVersion: '1.0.0',
clientId: 'your_client_id',
clientSecret: 'your_client_secret',
keySecret: 'your_key_secret',
);
}
copied to clipboard
Generate Token #
Use the generateToken() method to generate a token, which remains valid for 20 minutes:
TokenResponse? tokenResponse = await paymentManager.generateToken();
copied to clipboard
Response (tokenResponse):
{
"CodeRetour": 200,
"DescRetour": "Génération TOKEN.",
"DetailRetour": "",
"Data": {
"Token": "Bearer <token>"
}
}
copied to clipboard
Initialize Payment #
Initiate a payment process using the initializePayment() method:

token: The generated token.
montant: The amount of the transaction.
devise: The currency of the transaction (e.g EUR).
reference: The pro external reference.
panier: The identifier for the transaction.
notifUrl: URL called when the payment is finished.
redirectUrl: URL to redirect the customer after completing the payment.

InitPaymentResponse? initPaymentResponse = await paymentManager.initializePayment(
token,
montant,
devise,
reference,
panier,
notifUrl,
redirectUrl,
);
copied to clipboard
Response (initPaymentResponse):
{
"CodeRetour": 200,
"DescRetour": "Génération lien de paiement.",
"DetailRetour": "",
"Data": {
"url": "https://link.com"
}
}
copied to clipboard
Check Transaction Status #
Retrieve the status of a transaction using the getTransactionsStatus() method:

token: The generated token.
paymentLink: The payment link.

TransactionStatusResponse? transactionStatusResponse = await paymentManager.checkTransactionStatus(
token,
paymentLink,
);
copied to clipboard
Response (status):
{
"CodeRetour": 200,
"DescRetour": "Transaction status.",
"DetailRetour": "",
"Data": {
"reference_VPI": "VPI23011201010101",
"panier" : "panier123",
"reference": "ABC-1234",
"montant": 58.5,
"etat": "SUCCESS"
}
}
copied to clipboard
Validate Data Authenticity #
Validate the authenticity of provided data using the validateDataAuthenticity() method:

vpiSignature: The signature extracted from the headers.
body: The data to be hashed and compared against the signature.

bool isAuthentic = paymentManager.validateDataAuthenticity(vpiSignature, body);
copied to clipboard
Contributions and Issues #
Contributions and bug reports are welcome! Please feel free to submit a pull request or open an issue on the GitHub repository: Here.

Copyright © 2024 Vanilla Pay. All rights reserved.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.