You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-39Lines changed: 19 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,8 +29,8 @@ yarn add react-native-paystack
29
29
```
30
30
31
31
### 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
34
34
35
35
### Configuration
36
36
@@ -40,7 +40,7 @@ yarn add react-native-paystack
40
40
react-native link react-native-paystack
41
41
```
42
42
- (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/).
44
44
- Extract `Paystack.framework` from the downloaded zip.
45
45
- 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`.
46
46
- Your files tree in XCode should look similar to the screenshot below:
### 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.
118
118
119
119
```javascript
120
-
RNPaystack.getToken(cardParams);
120
+
RNPaystack.chargeCardWithAccessCode(cardParams);
121
121
```
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:
123
123
124
124
```js
125
125
importRNPaystackfrom'react-native-paystack';
126
126
127
-
getToken() {
127
+
chargeCard() {
128
128
129
-
RNPaystack.getToken({
129
+
RNPaystack.chargeCardWithAccessCode({
130
130
cardNumber:'4123450131001381',
131
131
expiryMonth:'10',
132
132
expiryYear:'17',
133
-
cvc:'883'
133
+
cvc:'883',
134
+
accessCode:'2p3j42th639duy4'
134
135
})
135
136
.then(response=> {
136
137
console.log(response); // do stuff with the token
@@ -152,43 +153,20 @@ getToken() {
152
153
| expiryMonth | string | the card expiry month as a double-digit ranging from 1-12 e.g 10 (October) |
153
154
| expiryYear | string | the card expiry year as a double-digit e.g 15 |
154
155
| 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 |
155
157
156
158
#### Response Object
157
159
158
160
An object of the form is returned from a successful token request
159
161
160
162
```javascript
161
163
{
162
-
token:"PSTK_4aw6i0yizwvyzjx",
163
-
last4:"1381"
164
+
reference:"trx_1k2o600w"
164
165
}
165
166
```
166
167
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).
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.
192
170
193
171
```javascript
194
172
RNPaystack.chargeCard(chargeParams);
@@ -279,7 +257,9 @@ Perhaps needless to say, this module leverages the [Paystack Android SDK](https:
279
257
+ 2.1.1: Upgraded to v2.1+ of both the Paystack iOS and Android SDKs.
280
258
+ 2.1.1: Added support for `chargeCard` on both platforms.
281
259
+ 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.
0 commit comments