@flipeet/pay-sdk
v1.0.6
Published
Official flipeet pay sdk
Keywords
Readme
@flipeet/pay-sdk
FlipeetPay SDK is a powerful tool for integrating seamless payments via the Solana blockchain. It allows developers to initiate transactions, track payment statuses, and manage credentials securely.
Table of Contents
Installation
To install the SDK, use npm or yarn:
npm install @flipeet/pay-sdk
# or
yarn add @flipeet/pay-sdkGetting Started
1. Import the SDK
import FlipeetPaySDK from '@flipeet/pay-sdk';2. Initialize the SDK
Create an instance of the SDK:
const sdk = new FlipeetPaySDK();Setting Credentials
Before initiating any transactions, set your client credentials using the setCredentials method:
sdk.setCredentials({
clientKey: 'your-client-key',
clientSecret: 'your-client-secret',
});Initiating Transactions
To initiate a transaction on the Solana blockchain:
import { TransactionDto } from '@flipeet/pay-sdk/lib/src/@types';
// Define the transaction payload
const payload: TransactionDto = {
amount: 1000,
email: '[email protected]',
currency: 'ngn',
memo: 'test payment',
reference: randomUUID(),
redirectUrl: 'https://redirect.com',
};
// Initiate the transaction and listen for status updates
sdk.transaction.initiate(
payload,
({ txRef, status }) => {
switch (status) {
case 'completed': // show success dialog
break;
case 'expired': // show expired dialog
break;
}
sdk.transaction.stopListening();
},
error => {
sdk.transaction.stopListening();
}
);