Skip to content

ponchocare/pp-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pp-nodejs

Tools to integrate PonchoPay on NodeJS

Installation

Install it from npm:

npm i @ponchopay/pp-nodejs

Usage

This package declares 2 objects:

createToken: function

Importing:

import { createToken } from '@ponchopay/pp-nodejs';

Parameters:

Parameter Mandatory Type Description
key Yes string Integration key
metadata Yes string Any string you want to keep saved within the payment

Returns: It returns an string containing the token to be used to initate a payment

Client: class

Importing:

import { Client } from '@ponchopay/pp-nodejs';

Constructor:

Parameter Mandatory Type Description
key Yes string Integration key
base No string Base PonchoPay URL to use. Default: https://pay.ponchopay.com/

Methods:

initiatePayment:

Parameters:

Parameter Mandatory Type Description
init Yes object Payment initialisation object

The payment initialisation object is defined as follows:

Parameter Mandatory Type Description
metadata Yes string Any string you want to keep saved within the payment
urn Yes string The Unique Reference Number
amount Yes number The payable amount in pences
email Yes string The user email
note No string Any note to be attached to the payment
expiry No Date or string The date you want the payment to expire

Returns: It returns the URL the user needs to use to make the payment.

Development

Linting and formatting

To scan the project for linting and formatting errors, run

npm run lint

To automatically fix linting and formatting errors, run

npm run format

Testing

To ensure the project is bug-free, run

npm run test