@sixergame/cashfree-sdk
v0.0.8
Published
Sixergame's Cashfree Payment SDK
Downloads
14
Readme
Sixer Cashfree Payment SDK
This is a custom payments SDK for cashfree meant to be used for @sixergame projects. It is a wrapper around the cashfree API, and is not a complete implementation of the API.
Installation
npm install @sixergame/payments-sdk
Usage
Instantiate the SDK
import { CashfreePaymentSDK } from '@sixergame/payments-sdk';
const cashfree = new Cashfree({
env: 'TEST',
clientKey: process.env.CASHFREE_PAYOUT_CLIENT_KEY_TEST,
clientSecret: process.env.CASHFREE_PAYOUT_CLIENT_ID_TEST,
})
| Option | Default | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| env
| TEST
| Environment to be initialized. Can be set to TEST
or PRODUCTION
|
| clientId
| | `clientId` which can be generated on cashfree dashboard. |
| `clientSecret` |
| clientSecret
which can be found alongside generated ClientId
. |
All functions return a promise and therefore can be used with async/await.
Beneficiary
Create Beneficiary
const beneficiary = await cashfree.beneficiary.addBeneficiary({
beneId: 'GREEN0001',
name: 'john doe',
email: '[email protected]',
phone: '9876543210',
bankAccount: '11111111222234',
ifsc: 'HDFC0000001',
address1: 'ABC Street',
city: 'Bangalore',
state: 'Karnataka',
pincode: '560001',
})
Get Beneficiary
const beneficiary = await cashfree.beneficiary.getBeneficiaryById('GREEN0001')
Transfers
Create Sync Transfer
const transfer = await cashfree.transfers.requestSyncTransfer({
transferId: 'ASDFG32',
amount: '100',
beneId: 'BENE007',
})
Create Async Transfer
const transfer = await cashfree.transfers.requestAsyncTransfer({
transferId: 'ASDFG32',
amount: '100',
beneId: 'BENE007',
})
Get Transfer Status
const transfer = await cashfree.transfers.getTransferStatus({
transferId: 'ASDFG32',
referenceId: 'REF3222',
})
Only one of
transferId
orreferenceId
is required.