Last updated:
0 purchases
paystack standard
Paystack Standard Flutter Package #
Paystack Standard simplifies the Paystack integration - without exposing your PUB_KEY.
This is done using Paystack Redirect.
Features #
All payment methods offered by paystack
Getting started #
Installation #
flutter pub add paystack_standard
copied to clipboard
Usage #
Initialise Transaction
This is done from your backend server using your SECRET-KEY as shown. ref
const https = require('https')
const params = JSON.stringify({
"email": "[email protected]",
"amount": "20000"
})
const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/transaction/initialize',
method: 'POST',
headers: {
Authorization: 'Bearer SECRET_KEY',
'Content-Type': 'application/json'
}
}
const req = https.request(options, res => {
let data = ''
res.on('data', (chunk) => {
data += chunk
});
res.on('end', () => {
console.log(JSON.parse(data))
})
}).on('error', error => {
console.error(error)
})
req.write(params)
req.end()
copied to clipboard
Sample Response
{
"status": true,
"message": "Authorization URL created",
"data": {
"authorization_url": "https://checkout.paystack.com/0peioxfhpn",
"access_code": "0peioxfhpn",
"reference": "7PVGX8MEk85tgeEpVDtD"
}
}
copied to clipboard
An authorization_url is returned - your backend server should send this to the front end/client to checkout.
NB: Please ensure to set your redirect url when initialising the paystack transaction. #
Checkout/Payment
The authorization_url sent from your backend server is used as the only parameter to Paystack Standard interface.
The PaystackStandard.checkout method returns type CheckoutResponse which contains a success - bool, and the transaction reference.
PaystackStandard(context).checkout(checkoutUrl: "<authorization_url>").then((response){
// here check for success - verify transaction status with your backend server
});
copied to clipboard
ScreenShots #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.