Skip to content

Latest commit

 

History

History
90 lines (67 loc) · 1.71 KB

README.md

File metadata and controls

90 lines (67 loc) · 1.71 KB

Khipu Node JS

Complete documentation

This library is an implementation made in javascript of the Khipu API, it is incomplete and only contemplates functionalities that will be used by banks and payments, if you want to add the rest, do it without problems.

Support Version

Current support Khipu API version 2.0

Install

Npm:

npm install --save khipujs

Yarn:

yarn add khipujs

Getting started

Authenticate with your Commerce ID Key, and Secret Key

Make sure you have created your free account on Khipu and that you have your Credentials.

import Khipu from 'khipujs'

const khipu = new Khipu({
  commerceId: 'COMMERCE_ID',
  secretKey: 'YOUR_SECRET_KEY'
})

Payments

Payments with notification token

khipu.payments
  .withNotificationToken({
    notification_token: 'string'
  })
  .then(response => {})
  .catch(error => console.log(error)) // Handle the error.

Create payment

khipu.payments
  .create({
    subject: 'First Product',
    currency: 'CLP',
    amount: '1000'
  })
  .then(response => {})
  .catch(error => console.log(error)) // Handle the error.

Read payment

khipu.payments
  .read(paymentId)
  .then(response => {})
  .catch(error => console.log(error)) // Handle the error.

Delete payment

khipu.payments
  .delete(paymentId)
  .then(response => {})
  .catch(error => console.log(error)) // Handle the error.

Banks

list banks

khipu.banks
  .list()
  .then(response => {})
  .catch(error => console.log(error)) // Handle the error.