Skip to content

Files

Latest commit

8582eaa · Feb 14, 2023

History

History
52 lines (33 loc) · 1.31 KB

README.md

File metadata and controls

52 lines (33 loc) · 1.31 KB

API Client Library

npm npm size license

Typescript client library for repaya.io web3 payment APIs.

yarn add @repaya/client

Documentation docs.repaya.io.

Usage

Import the client

import { Client } from '@repaya/client'

Create payment session

const formId = '<FORM_ID>'

// Create payment session
const session = await client.sessions.create(formid, { customer: { id: '42' } })

After the session was created, use the session.checkoutUrl to redirect the customer to the payment page.


After the payment is completed, request its status and customer balances by the session ID.

const payment = await client.payments.getBySession(session.id)
// payment.status === 'completed'    // check payment status

const balances = await client.balances.getAll(formId, { customerId: '42' })

Command Line Interface

The package can be used via the npx command to access a convinient CLI:

Usage: npx @repaya/client [command] [params...] <key=value>