paystack-sdk 1.0.2 → 1.0.6
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 +7 -15
- package/dist/index.d.ts +2 -11
- package/dist/index.js +5 -23
- package/dist/paystack.d.ts +15 -0
- package/dist/paystack.js +32 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,28 +13,20 @@ 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.
|
|
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)
|
|
32
|
+
- [Plan](https://github.com/en1tan/paystack-node/blob/main/src/plan/README.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* Paystack SDK
|
|
4
|
-
* @author Asaju Enitan <@en1tan>
|
|
5
|
-
*/
|
|
6
|
-
export declare class Paystack {
|
|
7
|
-
readonly key: string;
|
|
8
|
-
private http;
|
|
9
|
-
charge: Charge;
|
|
10
|
-
constructor(key: string);
|
|
11
|
-
}
|
|
1
|
+
import Paystack from './paystack';
|
|
2
|
+
export = Paystack;
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Paystack SDK
|
|
8
|
-
* @author Asaju Enitan <@en1tan>
|
|
9
|
-
*/
|
|
10
|
-
var Paystack = /** @class */ (function () {
|
|
11
|
-
function Paystack(key) {
|
|
12
|
-
this.key = key;
|
|
13
|
-
this.http = new axios_1.Axios({
|
|
14
|
-
baseURL: 'https://api.paystack.co',
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: "Bearer ".concat(this.key),
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
this.charge = new charge_1.Charge(this.http);
|
|
21
|
-
}
|
|
22
|
-
return Paystack;
|
|
23
|
-
}());
|
|
24
|
-
exports.Paystack = Paystack;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const paystack_1 = __importDefault(require("./paystack"));
|
|
6
|
+
module.exports = paystack_1.default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICharge } from './charge';
|
|
2
|
+
import { IPlan } from './plan/plan';
|
|
3
|
+
import { ITransaction } from './transaction/transaction';
|
|
4
|
+
/**
|
|
5
|
+
* Paystack SDK
|
|
6
|
+
* @author Asaju Enitan <@en1tan>
|
|
7
|
+
*/
|
|
8
|
+
export default class Paystack {
|
|
9
|
+
readonly key: string;
|
|
10
|
+
private readonly http;
|
|
11
|
+
charge: ICharge;
|
|
12
|
+
transaction: ITransaction;
|
|
13
|
+
plan: IPlan;
|
|
14
|
+
constructor(key: string);
|
|
15
|
+
}
|
package/dist/paystack.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axios_1 = require("axios");
|
|
4
|
+
const charge_1 = require("./charge");
|
|
5
|
+
const plan_1 = require("./plan/plan");
|
|
6
|
+
const transaction_1 = require("./transaction/transaction");
|
|
7
|
+
/**
|
|
8
|
+
* Paystack SDK
|
|
9
|
+
* @author Asaju Enitan <@en1tan>
|
|
10
|
+
*/
|
|
11
|
+
class Paystack {
|
|
12
|
+
key;
|
|
13
|
+
http;
|
|
14
|
+
charge;
|
|
15
|
+
transaction;
|
|
16
|
+
plan;
|
|
17
|
+
constructor(key) {
|
|
18
|
+
this.key = key;
|
|
19
|
+
this.http = new axios_1.Axios({
|
|
20
|
+
baseURL: 'https://api.paystack.co',
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${this.key}`,
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
},
|
|
25
|
+
responseType: 'json',
|
|
26
|
+
});
|
|
27
|
+
this.charge = new charge_1.Charge(this.http);
|
|
28
|
+
this.transaction = new transaction_1.Transaction(this.http);
|
|
29
|
+
this.plan = new plan_1.Plan(this.http);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = Paystack;
|