telebirr Flutter sdk for telebirr payment API.
- Get toPayUrl from telebirr using telebirr sdk api
- appId
- appKey
- publicKey
- test url //for test mode
To use this plugin add 'flutter_telebirr' as dependency in your pubspec.yaml file. For example:
dependencies:
flutter_telebirr: ^0.0.2To allow your application to access telebirr api on the Internet, add the following permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET"/>
telebirr test urls are HTTP so you need to add the following attribute to the application element:
<application ... android:usesCleartextTraffic="true">To allow your application to access telebirr api on the Internet, add the following permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET"/>
telebirr test urls are HTTP so you need to add the following to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>- Configure
If you set test mode you need to pass testUrl provided by telebirr
Ps. Don't include /toTradeSDKPay at the end of test url,
instead use this format 'http://<IP>:<PORT>/service-openup'
TelebirrPayment.instance.configure(
publicKey: publicKey,
appId: '829c8596f5664aaf9e221b275b46eec0',
appKey: "e5e6ea0ce63a4e7da0d3d41c163d1eb8",
notifyUrl: "https://localhost/notifyUrl",
shortCode: "500279",
merchantDisplayName: "Organization name",
// mode: Mode.test,
// testUrl: 'http://<IP>:<PORT>/service-openup',
);- call
startPaymentand passitemNameandtotalAmount
...
final response = await TelebirrPayment.instance.startPayment(
itemName: "Goods name",
totalAmount: "10",
);- If you get successful response you can load
toPayUrlwith any url loader package.
...
var toPayUrl = '';
if(response !=null && response!.isSuccess){
toPayUrl = response.data?.toPayUrl ?? '';
}