Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infobip/payment-plugin-xamarin
Payment plugin for Xamarin
https://github.com/infobip/payment-plugin-xamarin
Last synced: 4 days ago
JSON representation
Payment plugin for Xamarin
- Host: GitHub
- URL: https://github.com/infobip/payment-plugin-xamarin
- Owner: infobip
- License: apache-2.0
- Created: 2014-01-29T10:54:08.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-13T09:18:19.000Z (almost 11 years ago)
- Last Synced: 2024-04-16T11:20:45.926Z (7 months ago)
- Language: C#
- Size: 895 KB
- Stars: 7
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Centili in-app Payment Plugin for Xamarin
*only for Android platform*This project is the Xamarin ([Xamarin](http://xamarin.com "Xamarin")) component which can be merged with your existing Xamarin project and enable you to use the Centili Mobile Payments system.
## Step By Step integration
1. Download our component and reference dll from _libs_ folder in your project (_Infobip.Mpayments.dll_).
2. Create a new _PurchaseRequest_ object in your code (with the _ApiKey_ as only mandatory field).
PurchaseRequest request = new Infobip.Mpayments.PurchaseRequest ("your-api-key-abc123abc123") {
ClientId = "test1"
};3. Register your call-backs (_PurchaseListener_) by ``` PurchaseManager.AttachPurchaseListener(new MyPurchaseListener()); ``` where _MyPurchaseListener_ extends _Java.Lang.Object_ [[?](http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/android_callable_wrappers/index.html#1.implementing-interfaces "Why must I extend Java.Lang.Object")] and implements the _Infobip.Mpayments.IPurchaseListener_ interface. It should contains these methods:
public void OnPurchaseCanceled (PurchaseResponse purchaseResponse)
{
// Your code goes here...
}
public void OnPurchaseFailed (PurchaseResponse purchaseResponse)
{
// Your code goes here...
}
public void OnPurchasePending (PurchaseResponse purchaseResponse)
{
// Your code goes here...
}
public void OnPurchaseSuccess (PurchaseResponse purchaseResponse)
{
// Your code goes here...
}
4. Call static method _PurchaseManager.StartPurchase(purchaseRequest, context)_.PurchaseManager.StartPurchase(purchaseRequest, applicationContext);
5. Your call-back methods will be invoked upon completing the payment request. All you have to do is handle the payment result in your application (additional info is provided by the _PurchaseResponse_).
public void OnPurchaseSuccess (PurchaseResponse purchaseResponse)
{
// Your code goes here...
// ex:
this.Users.FindById(purchaseResponse.ClientId).AddCredit(purchaseResponse.ItemAmount);
}## Additional methods
- You can *Infobip.Mpayments.Util.Logger*.*SetDebugModeEnabled(debugMode)* to 'true' or 'false' to get our logger output debug data. Defaults to 'false'.
- You can also set or un-set *PurchaseManager*.*PendingTransactionHandlingEnabled*, which will influence whether we will continue the pending payment when a new payment request is sent or start a new payment request. Default is 'true', which means that we will try to resume the unresolved transaction.Owners
------Framework Integration Team @ Infobip Belgrade, Serbia
*Android is a trademark of Google Inc.*
© 2013-2014, Infobip Ltd.