Strongly typed Node SDK for RiSE Payment Gateway
npm install @calistyle/rise-pg-node --save
Obtain an API key, username, and password, from the RiSE Payment Platform, and configure the RPG class.
const RPG = require('@calistyle/rise-pg-node').RPG
const rpg = new RPG({
apiKey: 'your-api-key',
username: 'your-username',
password: 'your-password',
debug: true,
sandbox: true
})
Every method returns a chainable promise:
// Create a new customer, customer account, and then a new transaction for that customer:
rpg.customer.addCustomer({
merchantId: 1,
email: 'foo-customer@example.com'
}).then((customer) => {
return rpg.customerAccount.addCustomerAccount({
merchantId: 1,
customerId: customer.id,
accountToken: 'tok_visa'
})
}).then((account) => {
return rpg.transaction.addTransactionCC({
merchantId: 1,
referenceCustomerId: account.customerId,
customerAccountId: account.id,
amount: 1600,
currency: 'usd'
})
}).then((transaction) => {
// New charge created on a new customer
}).catch((err) => {
// Deal with an error
})