paystack-sdk 1.0.3 → 1.0.4
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 +6 -15
- package/dist/paystack.d.ts +4 -2
- package/dist/paystack.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,28 +13,19 @@ For NPM
|
|
|
13
13
|
### Usage
|
|
14
14
|
For Typescript
|
|
15
15
|
```
|
|
16
|
-
import
|
|
16
|
+
import Paystack from 'paystack-sdk';
|
|
17
17
|
|
|
18
18
|
const paystack = new Paystack("secret_key);
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
For Javscript
|
|
22
22
|
```
|
|
23
|
-
const Paystack =
|
|
23
|
+
const Paystack = require('paystack-sdk');
|
|
24
|
+
const paystack = new Paystack("secret_key");
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
### Example Request
|
|
27
27
|
All methods use promise meaning you can either use the `async...await` or `then...catch` or `try...catch`
|
|
28
28
|
|
|
29
|
-
###
|
|
30
|
-
|
|
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
|
-
```
|
|
29
|
+
### Available Docs
|
|
30
|
+
- [Charge](https://github.com/en1tan/paystack-node/blob/main/src/charge/README.md)
|
|
31
|
+
- [Transaction](https://github.com/en1tan/paystack-node/blob/main/src/transaction/README.md)
|
package/dist/paystack.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICharge } from './charge/charge';
|
|
2
|
+
import { ITransaction } from './transaction/transaction';
|
|
2
3
|
/**
|
|
3
4
|
* Paystack SDK
|
|
4
5
|
* @author Asaju Enitan <@en1tan>
|
|
@@ -6,6 +7,7 @@ import { Charge } from './charge/charge';
|
|
|
6
7
|
export default class Paystack {
|
|
7
8
|
readonly key: string;
|
|
8
9
|
private http;
|
|
9
|
-
charge:
|
|
10
|
+
charge: ICharge;
|
|
11
|
+
transaction: ITransaction;
|
|
10
12
|
constructor(key: string);
|
|
11
13
|
}
|
package/dist/paystack.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const axios_1 = require("axios");
|
|
4
4
|
const charge_1 = require("./charge/charge");
|
|
5
|
+
const transaction_1 = require("./transaction/transaction");
|
|
5
6
|
/**
|
|
6
7
|
* Paystack SDK
|
|
7
8
|
* @author Asaju Enitan <@en1tan>
|
|
@@ -10,6 +11,7 @@ class Paystack {
|
|
|
10
11
|
key;
|
|
11
12
|
http;
|
|
12
13
|
charge;
|
|
14
|
+
transaction;
|
|
13
15
|
constructor(key) {
|
|
14
16
|
this.key = key;
|
|
15
17
|
this.http = new axios_1.Axios({
|
|
@@ -18,8 +20,10 @@ class Paystack {
|
|
|
18
20
|
Authorization: `Bearer ${this.key}`,
|
|
19
21
|
'Content-Type': 'application/json',
|
|
20
22
|
},
|
|
23
|
+
responseType: 'json',
|
|
21
24
|
});
|
|
22
25
|
this.charge = new charge_1.Charge(this.http);
|
|
26
|
+
this.transaction = new transaction_1.Transaction(this.http);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
exports.default = Paystack;
|