Skip to content

Commit 8f4f531

Browse files
committed
Publish v3.1.0
1 parent b75b3c3 commit 8f4f531

File tree

2 files changed

+20
-40
lines changed

2 files changed

+20
-40
lines changed

README.md

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ yarn add react-native-paystack
2929
```
3030

3131
### Versioning
32-
- For `RN <=0.39` use version 2+ e.g. react-native-paystack@2.1.4
33-
- For `RN >=0.40` use version 3+ e.g. react-native-paystack@3.0.4
32+
- For `RN <=0.39` use version 2+ e.g. react-native-paystack@2.2.0
33+
- For `RN >=0.40` use version 3+ e.g. react-native-paystack@3.1.0
3434

3535
### Configuration
3636

@@ -40,7 +40,7 @@ yarn add react-native-paystack
4040
react-native link react-native-paystack
4141
```
4242
- (iOS only): The next steps are necessary for iOS at this time as publishing to NPM seems to break symlinks contained in the Paystack iOS framework shipped with this package, thus causing XCode build errors.
43-
- Download a fresh copy of the `Paystack iOS framework` from [Dropbox](https://www.dropbox.com/s/rxds20w3ud4wqs2/PaystackiOS%20%283%29.zip?dl=0) or from their [releases page on Github](https://github.com/PaystackHQ/paystack-ios/releases/).
43+
- Download a fresh copy of the `Paystack iOS framework` from their [releases page on Github](https://github.com/PaystackHQ/paystack-ios/releases/).
4444
- Extract `Paystack.framework` from the downloaded zip.
4545
- In XCode's "Project navigator", right click on project name folder ➜ `Add Files to <Your-Project-Name>`. Ensure `Copy items if needed` and `Create groups` are checked and select your copy of `Paystack.framework`.
4646
- Your files tree in XCode should look similar to the screenshot below:
@@ -101,7 +101,7 @@ protected List<ReactPackage> getPackages() {
101101
{
102102
...
103103

104-
[Paystack setDefaultPublishableKey:@"INSERT-PUBLIC-KEY-HERE"];
104+
[Paystack setDefaultPublicKey:@"INSERT-PUBLIC-KEY-HERE"];
105105
...
106106

107107
}
@@ -110,27 +110,28 @@ protected List<ReactPackage> getPackages() {
110110
- For Android, add the following tag in your `android/app/src/main/AndroidManifest.xml` file:
111111

112112
```xml
113-
<meta-data android:name="co.paystack.android.PublishableKey" android:value="INSERT-PUBLIC-KEY-HERE"/>
113+
<meta-data android:name="co.paystack.android.PublicKey" android:value="INSERT-PUBLIC-KEY-HERE"/>
114114
```
115115

116-
### Getting a Token (iOS & Android - To be deprecated soon)
117-
It's a cinch to obtain a single-use card token using the react-native-paystack module. Pls note, the SDK assumes you are responsible for building the card form/UI.
116+
### Charging a Card with Access Code (iOS & Android)
117+
It's a cinch to charge a card token using the react-native-paystack module. 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. Pls note, the SDK assumes you are responsible for building the card form/UI.
118118

119119
```javascript
120-
RNPaystack.getToken(cardParams);
120+
RNPaystack.chargeCardWithAccessCode(cardParams);
121121
```
122-
To be more elaborate, `cardParams` is a Javascript `Object` representing the card to be tokenized and `RNPaystack.getToken()` returns a Javascript `Promise` like:
122+
To be more elaborate, `cardParams` is a Javascript `Object` representing the card to be charged and `RNPaystack.chargeCardWithAccessCode()` returns a Javascript `Promise` like:
123123

124124
```js
125125
import RNPaystack from 'react-native-paystack';
126126

127-
getToken() {
127+
chargeCard() {
128128

129-
RNPaystack.getToken({
129+
RNPaystack.chargeCardWithAccessCode({
130130
cardNumber: '4123450131001381',
131131
expiryMonth: '10',
132132
expiryYear: '17',
133-
cvc: '883'
133+
cvc: '883',
134+
accessCode: '2p3j42th639duy4'
134135
})
135136
.then(response => {
136137
console.log(response); // do stuff with the token
@@ -152,43 +153,20 @@ getToken() {
152153
| expiryMonth | string | the card expiry month as a double-digit ranging from 1-12 e.g 10 (October) |
153154
| expiryYear | string | the card expiry year as a double-digit e.g 15 |
154155
| cvc | string | the card 3/4 digit security code as a String e.g 123 |
156+
| accessCode | string | the access_code obtained for the charge |
155157

156158
#### Response Object
157159

158160
An object of the form is returned from a successful token request
159161

160162
```javascript
161163
{
162-
token: "PSTK_4aw6i0yizwvyzjx",
163-
last4: "1381"
164+
reference: "trx_1k2o600w"
164165
}
165166
```
166167

167-
168-
### Charging the tokens.
169-
Send the token to your server and create a charge by calling the Paystack REST API. An authorization_code will be returned once the single-use token has been charged successfully. You can learn more about the Paystack API [here](https://developers.paystack.co/docs/getting-started).
170-
171-
**Endpoint:** https://api.paystack.co/transaction/charge_token
172-
173-
**Parameters:**
174-
175-
- email - customer's email address (required)
176-
- reference - unique reference (required)
177-
- amount - Amount in Kobo (required)
178-
179-
**Example**
180-
181-
```bash
182-
curl https://api.paystack.co/transaction/charge_token \
183-
-H "Authorization: Bearer SECRET_KEY" \
184-
-H "Content-Type: application/json" \
185-
-d '{"token": "PSTK_r4ec2m75mrgsd8n9", "email": "customer@email.com", "amount": 10000, "reference": "amutaJHSYGWakinlade256"}' \
186-
-X POST
187-
188-
```
189-
190168
### Charging a Card (iOS & Android)
191-
Using the react-native-paystack module, you can complete the transaction with the Paystack Android and iOS SDKs. Note that as with getting a card token, the SDK assumes you are responsible for building the card form/UI.
169+
Using the react-native-paystack module, you can start and complete a transaction with the mobile Paystack Android and iOS 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. Note that as with charging with an access_code, the SDK assumes you are responsible for building the card form/UI.
192170

193171
```javascript
194172
RNPaystack.chargeCard(chargeParams);
@@ -279,7 +257,9 @@ Perhaps needless to say, this module leverages the [Paystack Android SDK](https:
279257
+ 2.1.1: Upgraded to v2.1+ of both the Paystack iOS and Android SDKs.
280258
+ 2.1.1: Added support for `chargeCard` on both platforms.
281259
+ 2.1.1: Added support for `subscriptions` and `split-payments`.
282-
+ 2.1.1: For v2-specific documentations, see [v2 Docs](./v2-Docs.md)
260+
+ 3.1.0: Retired support for `getToken` on both platforms.
261+
+ 3.1.0: Added support for `chargeCardWithAccessCode` on both platforms.
262+
+ 3.1.0: Upgraded to v3.*+ of both the Paystack iOS and Android SDKs.
283263

284264
## 6. License
285265

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "React Native Wrappers for Paystack Android & iOS Mobile SDKs",
44
"main": "index.js",
55
"author": "Tolu Olowu (Arttitude 360) <tolu@arttitude360.com>",
6-
"version": "3.0.4",
6+
"version": "3.1.0",
77
"scripts": {
88
},
99
"repository": {

0 commit comments

Comments
 (0)