paystack-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Paystack SDK
|
|
2
|
+
|
|
3
|
+
#### Why Another [Paystack](https://paystack.com) Package?
|
|
4
|
+
Other packages are either outdated or don't support types.
|
|
5
|
+
|
|
6
|
+
### Installation
|
|
7
|
+
For Yarn
|
|
8
|
+
`yarn add paystack-sdk`
|
|
9
|
+
|
|
10
|
+
For NPM
|
|
11
|
+
`npm install paystack-sdk`
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
For Typescript
|
|
15
|
+
```
|
|
16
|
+
import { Paystack } from 'paystack-sdk'
|
|
17
|
+
|
|
18
|
+
const paystack = new Paystack("secret_key);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For Javscript
|
|
22
|
+
```
|
|
23
|
+
const Paystack = new Paystack("secret_key")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Example Request
|
|
27
|
+
All methods use promise meaning you can either use the `async...await` or `then...catch` or `try...catch`
|
|
28
|
+
|
|
29
|
+
### Charge
|
|
30
|
+
#### Create Charge
|
|
31
|
+
```
|
|
32
|
+
paystack.charge.create({
|
|
33
|
+
email:"johndoe@example.com",
|
|
34
|
+
amount: 1000
|
|
35
|
+
}).then((charge) => {
|
|
36
|
+
console.log(charge)
|
|
37
|
+
}).catch((error) => {
|
|
38
|
+
console.error(error)
|
|
39
|
+
})
|
|
40
|
+
```
|
package/package.json
CHANGED