{"id":19445077,"url":"https://github.com/blinks32/cordova-paystack-plugin-updated","last_synced_at":"2026-05-16T09:03:10.251Z","repository":{"id":119880218,"uuid":"140957862","full_name":"blinks32/cordova-paystack-plugin-updated","owner":"blinks32","description":"This plugin allows to add Paystack Payments to your application using Paystack Native Mobile SDKs for Android \u0026 iOS","archived":false,"fork":false,"pushed_at":"2018-07-14T16:06:26.000Z","size":808,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T22:44:00.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blinks32.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-14T15:42:47.000Z","updated_at":"2019-03-28T04:45:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f550f9f-0c6d-4eb3-88c4-5d987e5b5beb","html_url":"https://github.com/blinks32/cordova-paystack-plugin-updated","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinks32%2Fcordova-paystack-plugin-updated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinks32%2Fcordova-paystack-plugin-updated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinks32%2Fcordova-paystack-plugin-updated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinks32%2Fcordova-paystack-plugin-updated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blinks32","download_url":"https://codeload.github.com/blinks32/cordova-paystack-plugin-updated/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240629660,"owners_count":19831893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:09:16.251Z","updated_at":"2026-05-16T09:03:10.181Z","avatar_url":"https://github.com/blinks32.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cordova/PhoneGap Wrapper for Paystack SDK \n\nfor Android \u0026 iOS by [Arttitude 360](http://www.arttitude360.com) with reference from https://github.com/tolu360/cordova-plugin-paystack\n\n## Index\n\n1. [Description](#1-description)\n2. [Installation](#3-installation)\n\t3. [Automatically (CLI / Plugman)](#automatically-cli--plugman)\n\t3. [Manually](#manually)\n\t3. [PhoneGap Build](#phonegap-build)\n3. [Usage](#3-usage)\n4. [Credits](#4-credits)\n5. [Changelog](#5-changelog)\n6. [License](#6-license)\n\n## 1. Description\n\nThis plugin allows to add Paystack Payments to your application using the [Paystack Mobile Android SDK](https://github.com/PaystackHQ/paystack-android) and the [Paystack Mobile iOS SDK](https://github.com/PaystackHQ/paystack-ios) libraries. \nWhile there are a million ways to build mobile applications these days, there are only very few ways to stay secure. The native Paystack SDK uses your pulishable/public key to generate a one-time token to be used to charge a card (on your backend/server) - this plugin allows you to do all that in your Cordova/PhoneGap app without worrying about your secret key being compromised. Your secret keys do not belong in version control and you should never use them in client-side code or in a Cordova/PhoneGap application.\n* Compatible with [Cordova Plugman](https://github.com/apache/cordova-plugman).\n* Officially supported by [PhoneGap Build](https://build.phonegap.com/plugins).\n\n## 2. Installation\n\n### Automatically (CLI / Plugman)\nPaystackPlugin is compatible with [Cordova Plugman](https://github.com/apache/cordova-plugman), compatible with [PhoneGap 3.0 CLI](http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface_add_features), here's how it works with the CLI:\n\nUsing the Cordova CLI and the [Cordova Plugin Registry](http://plugins.cordova.io)\n\ndownload directly from the repo may be slow.\n```\n$ cordova plugin add https://github.com/blinks32/cordova-paystack-plugin-updated\n```\n\nOr using the phonegap CLI\n```\n$ phonegap local plugin add https://github.com/blinks32/cordova-paystack-plugin-updated\n```\n\nPaystackPlugin.js is brought in automatically. There is no need to change or add anything in your html.\n\nTo build for Android, add ` xmlns:android=\"http://schemas.android.com/apk/res/android\"` to the `widget` tag of the `config.xml` file in the root of your project, while at it, include the following lines within a `platform` `(\u003cplatform name=\"android\"\u003e)`tag in your `config.xml`:\n\n```xml\n\u003cplatform name=\"android\"\u003e\n    ...\n    \u003cpreference name=\"android-minSdkVersion\" value=\"16\" /\u003e\n    \u003cconfig-file target=\"AndroidManifest.xml\" parent=\"application\"\u003e\n      \t\u003cmeta-data android:name=\"co.paystack.android.PublicKey\" android:value=\"INSERT-PUBLIC-KEY-HERE\"/\u003e\n    \u003c/config-file\u003e\n\u003c/platform\u003e\n```\n\nTo build for iOS, add the `publicKey` preference tag to the `config.xml` file in the root of your project (very bad things can happen without it):\n\n```xml\n\u003cplatform name=\"ios\"\u003e\n    ...\n    \u003cpreference name=\"publicKey\" value=\"INSERT-PUBLIC-KEY-HERE\" /\u003e\n\u003c/platform\u003e\n```\nYou must not forget to build your project again - each time you edit native code. Run `cordova build ios/android` or similar variants.\n\n\n## 3. Usage\n\n### Charging a Card with Access Code (iOS \u0026 Android)\n- Note: If you are working with XCode 8+, to allow encryptions work properly with the Paystack SDK, you may need to enable `Keychain Sharing` for your app. In the Capabilities pane, if Keychain Sharing isn’t enabled, toggle ON the switch in the Keychain Sharing section.\n\n\u003cimg width=400 title=\"XCode files tree\" src=\"./4_enablekeychain_2x.png\"\u003e\n\nIt's a cinch to charge a card with the Paystack SDKs using the PaystackPlugin. This is the recommended or the most-preferred workflow favored by the folks at Paystack. Initiate a new transaction on your server side using the appropriate [Paystack endpoint](https://developers.paystack.co/reference#initialize-a-transaction) - obtain an `access_code` and complete the charge on your mobile application. Like most Cordova/PhoneGap plugins, use the PaystackPlugin after the `deviceready` event is fired:\n\n```js\nwindow.PaystackPlugin.chargeCardWithAccessCode(successCallbackfn, failureCallbackfn, cardParams);\n```\nTo be more elaborate, `cardParams` is a Javascript `Object` representing the card to be tokenized.\n\n```js\ndocument.addEventListener(\"deviceready\", onDeviceReady, false);\n\nfunction onDeviceReady() {\n    // Now safe to use device APIs\n    window.PaystackPlugin.chargeCardWithAccessCode(\n      function(resp) {\n        // A valid one-timme-use token is obtained, do your thang!\n        console.log('charge successful: ', resp);\n      },\n      function(resp) {\n        // Something went wrong, oops - perhaps an invalid card.\n        console.log('charge failed: ', resp);\n      },\n      {\n        cardNumber: '4123450131001381', \n        expiryMonth: '10', \n        expiryYear: '17', \n        cvc: '883',\n        accessCode: '2p3j42th639duy4'\n    });\n}\n```\n\nYou must not forget to build your project again - each time you edit native code. Run `cordova build ios/android` or similar variants.\n\nExplaining the arguments to `window.PaystackPlugin.chargeCardWithAccessCode`:\n\n| Argument        | Type           | Description  |\n| ------------- |:-------------:| :-----|\n| cardNumber          | string | the card number as a String without any seperator e.g 5555555555554444 |\n| expiryMonth      | string      | the card expiry month as a double-digit ranging from 1-12 e.g 10 (October) |\n| expiryYear | string      | the card expiry year as a double-digit e.g 15 |\n| cvc | string | the card 3/4 digit security code as a String e.g 123 |\n| accessCode | string | the access_code obtained for the charge |\n\n#### Response Object\n\nAn object of the form is returned from a successful token request\n\n```javascript\n{\n  reference: \"12kkvn2no5\"\n}\n```\n\n### Charging a Card (iOS \u0026 Android)\nYou can start and complete a transaction using just the Paystack Mobile SDKs. With this option, you pass both your charge and card properties to the SDK - with this worklow, you initiate and complete a transaction on your mobile app. Like most Cordova/PhoneGap plugins, use the PaystackPlugin after the `deviceready` event is fired:\n\n```js\nwindow.PaystackPlugin.chargeCard(successCallbackfn, failureCallbackfn, chargeParams);\n```\nTo be more elaborate, `chargeParams` is a Javascript `Object` representing the parameters of the charge to be initiated.\n\n```js\ndocument.addEventListener(\"deviceready\", onDeviceReady, false);\n\nfunction onDeviceReady() {\n    // Now safe to use device APIs\n    window.PaystackPlugin.chargeCard(\n      function(resp) {\n        // charge successful, grab transaction reference - do your thang!\n        console.log('charge successful: ', resp);\n      },\n      function(resp) {\n        // Something went wrong, oops - perhaps an invalid card.\n        console.log('charge failed: ', resp);\n      },\n      {\n        cardNumber: '4123450131001381', \n        expiryMonth: '10', \n        expiryYear: '17', \n        cvc: '883',\n        email: 'chargeIOS@master.dev',\n        amountInKobo: 150000,\n        subAccount: 'ACCT_pz61jjjsslnx1d9',\n    });\n}\n```\n\nYou must not forget to build your project again - each time you edit native code. Run `cordova build ios/android` or similar variants to refresh your cached html/js views.\n\n#### Request Signature\n\n| Argument        | Type           | Description  |\n| ------------- |:-------------:| :-----|\n| cardNumber          | string | the card number as a String without any seperator e.g 5555555555554444 |\n| expiryMonth      | string      | the card expiry month as a double-digit ranging from 1-12 e.g 10 (October) |\n| expiryYear | string      | the card expiry year as a double-digit e.g 15 |\n| cvc | string | the card 3/4 digit security code as e.g 123 |\n| email | string | email of the user to be charged |\n| amountInKobo | integer | the transaction amount in kobo |\n| currency (optional) | string | sets the currency for the transaction e.g. USD |\n| plan (optional) | string | sets the plan ID if the transaction is to create a subscription e.g. PLN_n0p196bg73y4jcx |\n| subAccount (optional) | string | sets the subaccount ID for split-payment transactions e.g. ACCT_pz61jjjsslnx1d9 |\n| transactionCharge (optional) | integer | the amount to be charged on a split-payment, use only when `subAccount` is set |\n| bearer (optional) | string | sets which party bears paystack fees on a split-payment e.g. 'subaccount', use only when `subAccount` is set |\n| reference (optional) | string | sets the transaction reference which must be unique per transaction |\n\n#### Response Object\n\nAn object of the form is returned from a successful charge\n\n```javascript\n{\n  reference: \"trx_1k2o600w\"\n}\n```\n\n### Verifying a Charge\nVerify a charge by calling Paystack's [REST API](https://api.paystack.co/transaction/verify) with the `reference` obtained above. An `authorization_code` will be returned once the card has been charged successfully. Learn more about that [here](https://developers.paystack.co/docs/verify-transaction).\n\n **Parameter:** \n\n - reference  - the transaction reference (required)\n\n **Example**\n\n ```bash\n $ curl https://api.paystack.co/transaction/verify/trx_1k2o600w \\\n    -H \"Authorization: Bearer SECRET_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -X GET\n ```\n\n\n## 4. CREDITS\n\nThis plugin uses the [cordova-custom-config plugin](https://github.com/dpa99c/cordova-custom-config) to achieve easy and reversible changes to your application's `AndroidManifest.xml` file.\nPerhaps needless to say, this plugin leverages the [Paystack Android SDK](https://github.com/PaystackHQ/paystack-android) and the [Paystack iOS SDK](https://github.com/PaystackHQ/paystack-ios) for all the heavy liftings.\n\n## 5. CHANGELOG\n\n- 1.0.1: Initial version supporting Android.\n- 1.0.3: Code clean up and addition of arbitrary error codes.\n- 1.1.0: Added iOS support and bumped up Paystack Android library to v1.2, making 16 the min sdk you should target.\n- 2.0.0: No breaking changes at this time. Added `android-minSdkVersion=16` condition to Android builds. Added `chargeCard` method to Android APIs. Upgrade to v2.* of the Paystack Android SDK.\n- 2.1.0: Breaking Changes: Major changes to the public API.\n- 2.1.0: Upgraded to v2.1+ of both the Paystack iOS and Android SDKs.\n- 2.1.0: Added support for `chargeCard` on both platforms.\n- 2.1.0: Added support for `subscriptions` and `split-payments`.\n- 2.1.0: For v2-specific usage, see [v2 Docs](./v2-Docs.md).\n- 3.1.0: Retired support for `getToken` on both platforms.\n- 3.1.0: Added support for `chargeCardWithAccessCode` on both platforms.\n- 3.1.0: Upgraded to v3.*+ of both the Paystack iOS and Android SDKs.\n\n## 6. License\n\n This should be [The MIT License (MIT)](http://www.opensource.org/licenses/mit-license.html). I would have to get back to you on that!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinks32%2Fcordova-paystack-plugin-updated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblinks32%2Fcordova-paystack-plugin-updated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinks32%2Fcordova-paystack-plugin-updated/lists"}