Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions 45 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,51 @@ npm install @paystack/paystack-sdk --save

## Usage
Import and initialize the library:
```javascript
const Paystack = require('@paystack/paystack-sdk')
const paystack = new Paystack("sk_test_xxxxxx")

paystack.transaction.initialize({email: "test@example.com", amount: 20000})
.then(response => console.log(response))
.catch(error => console.log(error))
```

Import and initialize the library using ES module with `async/await`:
```javascript
import Paystack from '@paystack/paystack-sdk'
const paystack = new Paystack("sk_test_xxxxxx")
```

Initiate a request and parse response:
const initialize = async(email, amount) => {
const response = await paystack.transaction.initialize({
email,
amount
})

console.log(response)
}

const email = 'test@example.com'
const amount = 2000
initialize(email, amount)
```
paystack.customer.fetch({code: "CUS_o9rf5kuwei3lt4vl"})
.then(customer => console.log(customer))
.catch(error => console.log(error))

### Typescript
```typescript
import Paystack from '@paystack/paystack-sdk';
const paystack = new Paystack("sk_test_xxxxxx");

const initialize = async(email, amount) => {
const response = await paystack.transaction.initialize({
email,
amount
});

console.log(response);
}

const email = 'test@example.com';
const amount = 2000;
initialize(email, amount);
```

## Issues
Expand Down
2 changes: 1 addition & 1 deletion 2 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paystack/paystack-sdk",
"version": "1.0.0-beta.6",
"version": "1.0.0",
"description": "Paystack API wrapper for Node",
"author": "Paystack <integrations@paystack.com> (https://paystack.com/docs)",
"keywords": [
Expand Down
20 changes: 10 additions & 10 deletions 20 src/apis/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface UpdateRequest {
metadata?: string;
}

export interface ValidatteRequest {
export interface ValidateRequest {
code: string;
first_name: string;
last_name: string;
Expand Down Expand Up @@ -282,30 +282,30 @@ export class Customer extends BaseAPI {
* Validate a customer\'s identity
* Validate Customer
*/
async validatte(requestParameters: ValidatteRequest): Promise<Accepted> {
async validate(requestParameters: ValidateRequest): Promise<Accepted> {
if (requestParameters.code === null || requestParameters.code === undefined) {
throw new RequiredError('code','Required parameter code was null or undefined when calling validatte.');
throw new RequiredError('code','Required parameter code was null or undefined when calling validate.');
}
if (requestParameters.first_name === null || requestParameters.first_name === undefined) {
throw new RequiredError('first_name','Required parameter first_name was null or undefined when calling validatte.');
throw new RequiredError('first_name','Required parameter first_name was null or undefined when calling validate.');
}
if (requestParameters.last_name === null || requestParameters.last_name === undefined) {
throw new RequiredError('last_name','Required parameter last_name was null or undefined when calling validatte.');
throw new RequiredError('last_name','Required parameter last_name was null or undefined when calling validate.');
}
if (requestParameters.type === null || requestParameters.type === undefined) {
throw new RequiredError('type','Required parameter type was null or undefined when calling validatte.');
throw new RequiredError('type','Required parameter type was null or undefined when calling validate.');
}
if (requestParameters.country === null || requestParameters.country === undefined) {
throw new RequiredError('country','Required parameter country was null or undefined when calling validatte.');
throw new RequiredError('country','Required parameter country was null or undefined when calling validate.');
}
if (requestParameters.bvn === null || requestParameters.bvn === undefined) {
throw new RequiredError('bvn','Required parameter bvn was null or undefined when calling validatte.');
throw new RequiredError('bvn','Required parameter bvn was null or undefined when calling validate.');
}
if (requestParameters.bank_code === null || requestParameters.bank_code === undefined) {
throw new RequiredError('bank_code','Required parameter bank_code was null or undefined when calling validatte.');
throw new RequiredError('bank_code','Required parameter bank_code was null or undefined when calling validate.');
}
if (requestParameters.account_number === null || requestParameters.account_number === undefined) {
throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling validatte.');
throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling validate.');
}
const queryParameters: any = {};

Expand Down
3 changes: 2 additions & 1 deletion 3 src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ class Paystack {

}

module.exports = Paystack
module.exports = Paystack;
module.exports.default = Paystack;
2 changes: 1 addition & 1 deletion 2 src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class BaseAPI {
path: tempPath,
headers: {
"authorization": `Bearer ${this.apiKey}`,
"paystack-version": `@paystack/paystack-sdk - 1.0.0-beta.6`
"user-agent": `@paystack/paystack-sdk - 1.0.0`
}
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.