Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infobip/payment-plugin-cordova-phonegap
Payment plugin for Cordova/PhoneGap
https://github.com/infobip/payment-plugin-cordova-phonegap
Last synced: 4 days ago
JSON representation
Payment plugin for Cordova/PhoneGap
- Host: GitHub
- URL: https://github.com/infobip/payment-plugin-cordova-phonegap
- Owner: infobip
- Created: 2014-01-29T10:46:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-13T09:26:42.000Z (almost 11 years ago)
- Last Synced: 2024-04-16T11:20:45.906Z (7 months ago)
- Language: Java
- Size: 816 KB
- Stars: 10
- Watchers: 11
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Centili in-app Payment Plugin for Cordova/PhoneGap
=============================
*only for Android platform*Installation
------------To install the plugin to your Cordova project use the Cordova CLI Tool:
$ cordova plugin add com.infobip.mpayBasic usage
-----------Invoke the payment action by calling `startPayment` function:
centili.startPayment(args, success, error);
`args` is a JSONObject that contains the following variables:
var args = {
"apiKey": "", // mandatory
"clientId": "", // optional
"info": "Some info text...", // optional
"languageCode": "EN", // optional
"packageIndex": 0, // optional
"price": 0, // optional
"offline": false, // optional (default: false)
"testMode": false // optional (default: false)
}For more information about `args` fields check [this](https://www.centili.com/manual/android/android-instructions.pdf)
`success` and `error` are call-back functions that need to catch eventActions from the Centili Plugin
var success = function(purchaseResponse) {
if (purchaseResponse.status == "onPurchaseSuccess") {
//TODO: payment success
}
if (purchaseResponse.status == "onPurchasePending") {
//TODO: payment pending
//avoid blocking calls like alert();
}
};var error = function(purchaseResponse) {
if (purchaseResponse.status == "onPurchaseFailed") {
//TODO: payment faild
}
if (purchaseResponse.status == "onPurchaseCanceled") {
//TODO: payment canceled
}
if (purchaseResponse.status == "error") {
//TODO: error occurs
}
};`purchaseResponse` has the following fields:
purchaseResponse.status;
purchaseResponse.interval;
purchaseResponse.itemAmount;
purchaseResponse.price;
purchaseResponse.apiKey;
purchaseResponse.clientId;
purchaseResponse.currency;
purchaseResponse.errorMessage;
purchaseResponse.itemName;
purchaseResponse.transactionId;If `purchaseResponse` has status `error` than it contains the following fields:
purchaseResponse.status;
purchaseResponse.message;
purchaseResponse.stackTrace;
Advanced features usage
--------------------To enable debug mode in Android plugin set `setDebugModeEnabled` to true:
centili.setDebugModeEnabled(true, success, error);
To disable Pending Transaction Handling set `setPandingTransactionHandlingEnabled` to false:
centili.setPandingTransactionHandlingEnabled(false, success, error);
`success` and `error` are call-back functions.Offline mode
------------If offline mode is set to true, it is necessary to replace `libs/CentiliLib-2.jar` with a library downloaded from [Centili Partner Panel](https://www.centili.com/partners) for the specific service - in your Android project.
Examples
--------The example of the 'Hello World' project with the Centili Plugin can be found [here](https://github.com/infobip/payment-plugin-cordova-phonegap).
Owners
------Framework Integration Team @ Infobip Ltd.