Techpay Flutter Package
Introduction
Techpay is a reliable and secure payment solution designed to streamline payment processing and boost sales. With its user-friendly features and simple API integration, Techpay offers merchants of all sizes, from small startups to large enterprises, a hassle-free checkout experience for your customers. By incorporating Techpay into your online stores or websites, merchants can quickly accept payments and provide a convenient payment gateway solution.
Supported Payment Methods
Techpay supports a wide range of payment methods to cater to diverse customer preferences:
- Airtel Money
- MTN Money
- Zampay (Zamtel)
- VISA
- MasterCard
Whether customers prefer mobile payment solutions or traditional card payments, Techpay ensures a flexible and inclusive payment experience for all.
Getting Started
- Complete the merchant registration process on Techpay's website.
- Verify your account.
- Navigate to the API center, where you can configure specific settings and generate the required API keys.
App Keys
After submitting your configuration settings, your keys will be generated:
- App Auth: Identifier for your application.
- App Key: Unique key assigned to your app. This key can be reset at any time.
Usage
- Ensure the correct
minSdkVersion
is set inandroid/app/build.gradle
:
android {
defaultConfig {
minSdkVersion 19
}
}
-
Add
techpay
as a dependency in yourpubspec.yaml
file. -
Add the necessary imports:
import 'package:techpay/techpay.dart';
- Integrate the Techpay payment widget into your checkout screen:
Techpay(
apiKey: 'App Key',
appId: 'App Auth',
amount: 1.98,
reference: 'bill20230601',
orderNumber: '0202301',
onPaymentResponse: (response) {
// Process the payment response from Techpay
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(response['message'])));
// Continue your application's flow
Navigator.push(context, MaterialPageRoute(builder: (context) => HomeScreen));
}
),
Parameters:
amount
: Amount you require the customer to pay you.reference
: Description of the item being paid for or reason for the payment.orderNumber
: Order number for the payment.onPaymentResponse
: Callback function triggered post-payment. The JSON response parameter provides the payment's outcome, allowing you to proceed accordingly.
For example:
{
"code": 103,
"message": "Mobile money payment failed",
"response": "Successful request"
}
- A code of
100
indicates successful payment. Any other code suggests failure, and the message will clarify the reason for the failure.