- Welcome to lddPay SDK
- Core Concepts
- Configuration
- Data Flow
- Payout
- Examples
- Payment With KYC
- Payment Without KYC
- Payment With Crypto
- WooCommerce Payment Gateway
- Guide
- Getting Started
- API Key Generation
Welcome to lddPay SDK #
Introduction #
Overview #
The lddPay Payment SDK is a comprehensive, unified solution designed to simplify the integration of multiple payment methods into your applications. This SDK provides developers with a robust set of tools and APIs to facilitate seamless payment processing across various platforms.
Whether you’re building an e-commerce site, a subscription service, or a mobile app, the lddPay Payment SDK offers the flexibility and scalability needed to support a wide range of payment options, ensuring a smooth and secure transaction experience for your users.
Key Benefits #
- Consolidate multiple payment methods under a single interface, reducing complexity and integration time.
- Accept payments through various channels including credit/debit cards, PayPal, cryptocurrencies, digital wallets, and bank transfers — all within a single application.
- Dynamically configure payment methods based on the user’s location to comply with regional regulations and optimize the payment experience.
- Adheres to industry-standard encryption protocols and PCI-DSS compliance, ensuring secure transactions and protection of sensitive data.
- Comprehensive documentation, extensive code samples, and a well-designed API make it easy for developers of all skill levels to integrate and customize payment functionalities.
- Tailor the payment flow, user interface, and error handling mechanisms to align with your application’s branding and user experience needs.
支持 #
We’re here to help! If you have any issues or questions, please feel free to reach out to our dedicated support team. We are committed to making your integration process as smooth as possible.
- 📧 Contact Us: info@lddpay.com
Core Concepts #
The lddPay Payment SDK provides a powerful set of tools and features to facilitate seamless payment processing in your applications. Understanding the core concepts behind the SDK is essential for effective integration and customization. This section outlines the key concepts that form the foundation of the lddPay Payment SDK.
Payment Methods Supported #
The lddPay Payment SDK supports a variety of payment methods to ensure flexibility and wide-ranging compatibility across different platforms and regions.
Below are the payment methods you can integrate:
- Credit/Debit Cards: Process payments through major card networks like Visa, MasterCard, and American Express.
- PayPal: Allow users to make payments using their PayPal accounts.
- Cryptocurrencies: Support payments using popular cryptocurrencies such as Bitcoin, Ethereum, and others.
- Digital Wallets: Enable payments through digital wallets like Apple Pay, Google Pay, and Samsung Pay.
- Bank Transfers: Allow users to make direct bank transfers for payments.
Each payment method can be configured and customized according to your application’s requirements, providing a seamless checkout experience for your users.
Country-Specific Configuration #
The lddPay Payment SDK offers dynamic country-specific configurations to comply with regional regulations and optimize the payment experience:
- Payment Method Enablement: Based on the user’s country, the SDK can automatically enable or disable certain payment methods. This ensures that users only see payment options that are relevant and compliant with their local regulations.
- Currency Localization: The SDK supports transactions in multiple currencies, automatically selecting the appropriate currency based on the user’s location.
- Regional Compliance: The SDK is designed to meet country-specific regulatory requirements, such as GDPR in Europe or PCI-DSS standards globally, ensuring secure and compliant transactions.
Security and Compliance #
Security is a critical aspect of payment processing, and the lddPay Payment SDK is built with industry-leading security protocols to protect sensitive data and ensure compliance:
- Encryption Protocols: The SDK uses advanced encryption technologies to secure payment data both in transit and at rest. All transactions are encrypted to prevent unauthorized access and data breaches.
- PCI-DSS Compliance: The SDK adheres to the Payment Card Industry Data Security Standard (PCI-DSS), ensuring that your application meets the necessary security requirements for processing card payments.
- 代币化: Sensitive payment information is tokenized, meaning that actual payment data is never exposed or stored on your servers. This reduces the risk of data breaches and ensures compliance with security standards.
- Fraud Prevention: The SDK includes built-in fraud detection and prevention mechanisms to identify and mitigate potential fraudulent activities during payment processing.
Webhooks #
Webhooks are an essential feature of the lddPay Payment SDK, allowing you to receive real-time notifications about payment events:
- Event Notifications: Webhooks notify your application of various payment-related events, such as payment success, failure, refund initiation, or chargeback. These notifications are sent to a URL you specify during the API Key setup.
- Customization: You can configure webhooks to trigger for specific events and set different URLs for different environments (e.g., production vs. test). This ensures that your application responds appropriately to various payment scenarios.
- Security: Webhook data is securely transmitted using HTTPS, and can be verified using signatures or other authentication methods to ensure that the data comes from a trusted source.
Customization Options #
The lddPay Payment SDK is designed with flexibility in mind, offering extensive customization options to tailor the payment experience to your specific needs:
- Payment Flow: Customize the entire payment flow, from the payment initiation screen to the final confirmation page. You can integrate the SDK into your existing UI or create a new, branded payment experience.
- User Interface (UI): Modify the appearance of payment forms and buttons to match your application’s design and branding guidelines. The SDK supports custom themes, colors, and layouts.
- Error Handling: Implement custom error handling to provide users with clear and helpful messages when payment issues arise. This can include retry mechanisms, detailed error explanations, and alternative payment suggestions.
- Localization: The SDK supports multiple languages and currencies, allowing you to localize the payment experience based on the user’s region and preferences.
Configuration #
Configuring the lddPay Payment SDK is a crucial step to ensure it operates effectively within your application. This section provides a detailed guide on how to configure the SDK, including setting up API keys, customizing payment options, and managing webhooks.
API Key Configuration #
API Keys are central to using the lddPay Payment SDK, as they authenticate your application and grant access to payment processing features.
Obtaining API Keys #
- Generate API Keys: After logging into the lddPay Dashboard, navigate to the API Keys section and click on Create API Key.
- Configure API Key Settings: Name your API Key, choose the environment (Production or Test), set an optional expiry date, and select the currency type (Fiat or Crypto).
- Receive CLIENT_KEY and CLIENT_SECRET: Once configured, you’ll be provided with a CLIENT_KEY and CLIENT_SECRET. These should be stored securely, as they are required for SDK initialization and operation.
Environment Setup #
- Production vs. Test: Depending on your environment, you can set the API Key to either Production for live transactions or Test for development and testing purposes. Using the Test environment allows you to simulate transactions without affecting real accounts.
SDK Initialization #
To start using the SDK in your application, you need to initialize it with your API keys:
import { Banksy } from "banksy-sdk";
const banksy = new Banksy("YOUR_CLIENT_KEY");
export default banksy;
By initializing the SDK with your CLIENT_KEY, you’re ready to interact with the lddPay Payment services.
Payment Configuration #
The SDK allows you to configure various payment-related options to suit your application’s needs:
Currency Configuration #
- Default Currency: Set the default currency for transactions, either Fiat (e.g., USD, EUR) or Crypto (e.g., Bitcoin, Ethereum). This setting ensures that all payments are processed in the specified currency unless otherwise overridden.
Payment Methods #
- Enabling/Disabling Payment Methods: Based on your business requirements, you can enable or disable specific payment methods such as credit cards, PayPal, or cryptocurrencies. This can be configured dynamically based on the user’s location or preferences.
Country-Specific Settings #
- Localization: Configure the SDK to automatically adjust to the user’s locale, including language and currency settings, to provide a tailored payment experience.
- Regulatory Compliance: Ensure that payment methods and currencies comply with regional regulations, which can be configured in the lddPay Dashboard.
Country-Specific Settings #
Available Payment Status #
- awaiting: Payment is created not processed yet
- success: Once the payment is confirmed
- cancelled: Payment is cancelled by the user
- failed: Payment failed for a reason
- disputed: Once user raised any dispute
- refunded: Once the payment is successfully refunded
Webhook Configuration #
Webhooks allow your application to receive real-time notifications about payment events, such as successful payments, refunds, or failures.
Setting Up Webhooks #
- Configure Webhook URLs: In the lddPay Dashboard, navigate to the Webhooks section and add the URL(s) where you want to receive notifications. You can set up different URLs for various environments (e.g., production, test).
- Event Selection: Choose the specific events for which you want to receive notifications, such as
payment.success
,payment.failure
, orrefund.initiated
.
Sample Webhook Data
{
"paymentId": "******************",
"paymentRaw": {
"id": "******************",
"keyUsed": "ck_live_***********",
"amount": 48.99,
"currency": "USD",
"successCallback": "YOUR_SUCCESS_CALLBACK_URL",
"failureCallback": "YOUR_FAILURE_CALLBACK_URL",
"status": "success",
"environment": "live",
"createdAt": "2024-10-30T13:34:00.535Z",
"context": {YOUR_CONTEXT_OBJECT}
}
}
Security Considerations #
- Signature Verification: To ensure the authenticity of the data received, enable signature verification in your webhook settings. This allows your application to verify that the webhook data originates from lddPay.
- HTTPS: Always use HTTPS for your webhook URLs to ensure that data is transmitted securely.
Advanced Configuration Options #
For more advanced use cases, the lddPay Payment SDK offers additional configuration options:
Timeout Settings #
- Custom Timeouts: Adjust the timeout settings for payment requests to manage latency or network issues. This can prevent transactions from failing due to timeouts, especially in regions with slower internet connections.
Retry Mechanisms #
- Automatic Retries: Enable automatic retries for failed transactions. This setting allows the SDK to attempt the transaction again if it fails due to temporary issues like network instability.
Logging and Debugging #
- Enable Logging: For development and debugging purposes, you can enable detailed logging within the SDK. This logs all API calls and responses, making it easier to troubleshoot issues.
- Debug Mode: Activate Debug Mode to receive more verbose output during testing. This mode is especially useful for identifying issues during integration.
Best Practices for Configuration #
To ensure optimal performance and security, follow these best practices when configuring the lddPay Payment SDK:
- Store API Keys Securely: Use environment variables or secure vaults to store your CLIENT_KEY and CLIENT_SECRET. Avoid hard-coding these values directly into your application code.
- Test Configurations in Sandbox: Always test your configurations in the Test environment before going live. This helps you identify and resolve potential issues without affecting real transactions.
- Regularly Rotate API Keys: For enhanced security, periodically rotate your API keys and update your SDK configuration accordingly.
- Monitor Webhook Activity: Regularly monitor your webhook logs to ensure that your application is receiving and handling events correctly.
Data Flow #
Understanding the data flow in the lddPay Payment SDK is crucial for integrating payment processes smoothly into your application. This section outlines the typical flow of data from the initiation of a payment to its completion, including how the SDK interacts with your application and external payment providers.
Overview of the Payment Process #
The lddPay Payment SDK manages the entire payment process, from creating a payment request to handling the final confirmation. Below is a step-by-step breakdown of the data flow:
Payment Initialization #
- Client-Side Request:
The process begins when the user selects a product or service and initiates a payment on the client side (e.g., your web or mobile app). The user typically inputs necessary details such as the amount, currency, and payment method. - Payload Creation:
Your application creates a payment payload, which includes details like the amount, currency, customer information, and callback URLs for success and failure events.
Create Payment Request #
SDK Invocation:
The SDK is invoked to create a payment using the provided payload. This is done through the createPayment
method:
const paymentPayload = {
amount: 100,
currency: "USD",
successCallback: "https://yourdomain.com/success",
failureCallback: "https://yourdomain.com/failure",
currencyType: "fiat",
isKycOptional: false
};
const paymentData = await banksy.createPayment(paymentPayload);
- 付款处理:
The SDK sends the payment payload to the lddPay backend, which processes the request and interacts with the selected payment provider.
Payment Link Generation #
- Receive Payment Link:
After processing the payment request, the SDK returns a payment link. This link directs the user to the payment provider’s interface where the payment can be completed.console.log("Payment Link: ", paymentData.paymentLink);
window.location.href = paymentData.paymentLink;
User Completes Payment #
- Redirection to Payment Provider:
The user is redirected to the payment provider’s platform (e.g., a bank’s payment gateway or a PayPal interface) to complete the transaction. - Payment Completion:
Once the user completes the payment, the payment provider processes the transaction and redirects the user back to your application using the success or failure callback URL provided in the payload.
Success/Failure Handling #
Callback Handling:
Depending on the outcome of the payment, the user is redirected back to your application with a status indicator in the query parameters (paymentId
and status
):
- Success: If the payment is successful, the user is redirected to the success URL with a
paymentId
indicating the completed transaction. - Failure: If the payment fails, the user is redirected to the failure URL with a
status
parameter indicating the reason for the failure.
Payment Verification:
Upon receiving the paymentId
in the callback, your application should verify the status of the payment using the SDK:
const paymentStatus = await banksy.getPayment(paymentId);
if (paymentStatus.success) {
console.log("Payment Successful: ", paymentStatus);
} else {
console.error("Payment Failed: ", paymentStatus);
}
- Final Confirmation:
The SDK interacts with the lddPay backend to confirm the payment status, ensuring that the transaction is successfully recorded and processed.
Webhook Notifications #
- Real-Time Updates:
As part of the payment process, webhooks can be configured to receive real-time notifications of payment events. These webhooks provide updates on payment success, failure, refunds, and other events, enabling your application to respond dynamically to different payment scenarios.
Payout #
The Payout Page in the lddPay system is designed to allow clients to receive funds from the payments made by their customers. This page provides all the necessary tools to manage, track, and request payouts from your customer transactions over specific time ranges. Contact lddPay for further Payout information.
Key Features of the Payout: #
- Wallet Configuration: Set up your TRON (USDT) wallet address where payouts will be sent.
- Request Payouts: Request a payout based on customer transactions for a specified date range and currency.
- Track Payout Requests: View and track the status of your payout requests, including details like amount, currency, and status.
- Transaction Summary: Review individual transactions that are part of the payout, ensuring full transparency.
This page simplifies the process of transferring funds from customer payments to the client’s configured wallet, allowing for flexible payout requests based on date ranges and different currencies.
Examples #
Payment With KYC #
Overview #
This section outlines the process of handling payments that require KYC (Know Your Customer) verification. This flow is typically used for higher-risk transactions, large amounts, or when regulatory compliance requires identity verification.
Steps to Implement Payment With KYC #

1. Initialize the lddPay SDK #
Set up the SDK with your API key and specify the environment (production or sandbox).
2. Perform KYC Verification #
Implement the KYC process, verifying the user’s identity before proceeding with the payment.
3. Create a Payment #
After successful KYC verification, prepare the payment payload and create the payment.
4. Redirect to Payment Provider #
The SDK will generate a payment link upon creating the payment. Redirect the user to this link to complete the payment.
5. Handle Payment Success/Failure #
Use the callback URLs to manage the outcome of the payment. Handle both success and failure cases.
Code Example #
import { Banksy } from "banksy-sdk";
// Step 1: Initialize the banksy SDK
const apiKey = "your-client-key";
const banksy = new Banksy(apiKey);
// Step 2: Implement KYC Verification (Pseudo-code for KYC step)
// This part depends on the specifics of your KYC process
async function verifyKYC(customerData) {
try {
const kycVerified = await someKYCService.verify(customerData);
return kycVerified;
} catch (error) {
console.error("KYC verification failed: ", error.message);
throw error;
}
}
// Step 3: Create a payment after KYC
async function initiatePaymentWithKYC(customerData) {
try {
const kycVerified = await verifyKYC(customerData);
if (kycVerified) {
const paymentPayload = {
amount: 1000,
currency: "USD",
successCallback: "https://yourdomain.com/success",
failureCallback: "https://yourdomain.com/failure",
currencyType: "fiat"
isKycOptional: false
};
const payment = await banksy.createPayment(paymentPayload);
console.log("Payment Created: ", payment);
// Step 4: Redirect to the payment provider's gateway
window.location.href = payment.paymentLink;
}
} catch (error) {
console.error("Payment failed: ", error.message);
}
}
// Example usage with customer data for KYC
const customerData = { /* Customer details for KYC */ };
initiatePaymentWithKYC(customerData);
Best Practices #
- Ensure KYC Compliance: Use a reliable KYC service to verify user identities and comply with regulatory requirements.
- Secure Data Handling: Ensure that customer data used for KYC is securely transmitted and stored to protect sensitive information.
- Error Handling: Implement error handling for both the KYC process and the payment creation to manage any issues that arise.
Payment Without KYC #
Overview #
This section covers the process of handling payments that do not require KYC (Know Your Customer) verification. This flow is ideal for low-risk transactions where regulatory compliance does not mandate identity verification.
Steps to Implement Payment Without KYC #

1. Initialize the lddPay SDK #
Set up the SDK with your API key and specify the environment (production or sandbox).
2. Create a Payment #
Prepare the payment payload, which includes details such as amount, currency, customer information, and callback URLs for success and failure scenarios.
3. Redirect to Payment Provider #
After creating the payment, the SDK will generate a payment link. Redirect the user to this link to complete the payment.
4. Handle Payment Success/Failure #
Use the provided callback URLs to manage the outcome of the payment. Handle success and failure cases accordingly.
Code Example #
import { Banksy } from "banksy-sdk";
// Step 1: Initialize the banksy SDK
const apiKey = "your-client-key";
const banksy = new Banksy(apiKey);
// Step 2: Create a payment without KYC
async function initiatePaymentWithoutKYC() {
const paymentPayload = {
amount: 100,
currency: "USD",
successCallback: "https://yourdomain.com/success",
failureCallback: "https://yourdomain.com/failure",
customerName: "John Doe",
customerEmail: "john.doe@example.com",
currencyType: "fiat",
isKycOptional: true
};
try {
const payment = await banksy.createPayment(paymentPayload);
console.log("Payment Created: ", payment);
// Step 3: Redirect to the payment provider's gateway
window.location.href = payment.paymentLink;
} catch (error) {
console.error("Error creating payment: ", error.message);
}
}
initiatePaymentWithoutKYC();
Best Practices #
- Use Secure Callbacks: Ensure that your success and failure callback URLs are secure (HTTPS) to protect the integrity of the payment process.
- Error Handling: Implement robust error handling to manage any issues during payment creation or redirection.
Payment With Crypto #
Overview #
The lddPay Payment SDK supports cryptocurrency payments, allowing users to pay with digital assets like USDT (Tether), USDC (USD Coin), or ETH (Ethereum).
This section provides guidance on how to implement and handle crypto payments within your application, supporting both USDT and USDC on the Ethereum and Polygon blockchains, along with native currency payments (ETH on Ethereum and POL on Polygon)
Steps to Implement Payment with Crypto #
1. Initialize the lddPay SDK #
Set up the SDK with your API key and specify the environment (production or sandbox).
2. Create a Crypto Payment #
Prepare the payment payload specifically for a crypto transaction, including details like the currency type, amount, and cryptocurrency details.
3. Handle Payment Success/Failure #
Use the provided callback URLs to manage the outcome of the payment.
Code Example #
import { Banksy } from "banksy-sdk";
// Step 1: Initialize the banksy SDK
const apiKey = "your-client-key";
const banksy = new Banksy(apiKey); // Use "sandbox" for testing
// Step 2: Create a crypto payment
async function initiateCryptoPayment() {
const paymentPayload = {
currencyType: "banksy-pay", // Specifies that this is a banksy Pay transaction
amount: 100, // Amount to charge in the specified currency
currency: "INR", // Currency for the transaction
successCallback: "http://localhost:3000/success", // URL to redirect on success
failureCallback: "http://localhost:3000/failure", // URL to redirect on failure
externalClientId: "cd99d68f-db08-485a-ac74-b8b64a55a3c2", // Optional external client ID
isKycOptional: true, // Specifies whether KYC is optional for this transaction
customerEmail: "parth25@example.com", // Customer's email
crypto: {
tokenName: "USDC", // Name of the cryptocurrency token
blockchainSymbol: "ETH",
blockchainName: "ethereum"
}
};
try {
const payment = await banksy.createPayment(paymentPayload);
console.log("Crypto Payment Created: ", payment);
// Redirect to the payment provider's gateway
window.location.href = payment.paymentLink;
} catch (error) {
console.error("Error creating crypto payment: ", error.message);
}
}
initiateCryptoPayment();
Supported Options #
When configuring the crypto
field in the payment payload, you can use the following options for tokenName
,blockchainSymbol
,blockchainName
:
- tokenName:
USDT
(Tether)USDC
(USD Coin)ETH
(Ethereum, if using native currency)POL
(Polygon, if using native currency)TRON
(Tron, if using native currency)AVAX
(Avalanche, if using native currency)ARB
(Arbitrum, if using native currency)BSC
(Binance Smart Chain, if using native currency)
- blockchainSymbol:
ETH
(for transactions on the Ethereum blockchain)POL
(for transactions on the Polygon blockchain)TRON
(for transactions on the Tron blockchain)AVAX
(for transactions on the Avalanche blockchain)ARB
(for transactions on the Arbitrum blockchain)BSC
(for transactions on the Binance Smart Chain)
- blockchainName:
ethereum
(for transactions on the Ethereum blockchain)polygon
(for transactions on the Polygon blockchain)tron
(for transactions on the Tron blockchain)avalanche
(for transactions on the Avalanche blockchain)arbitrum
(for transactions on the Arbitrum blockchain)binance-smart-chain
(for transactions on the Binance Smart Chain)
Key Concepts #
- Currency Type: The
currencyType
is set to"banky-pay"
to specify that the payment will be processed using the banksy Payment SDK. - Cryptocurrency Details: The
crypto
field includes the name of the cryptocurrency token, the blockchain symbol, and the blockchain name. - KYC Optionality: The
isKycOptional
flag can be set totrue
orfalse
, depending on whether KYC is required for the transaction.
Handling Success and Failure #
- Success Callback: If the payment is successful, the user will be redirected to the URL specified in
successCallback
. - Failure Callback: If the payment fails, the user will be redirected to the URL specified in
failureCallback
.
WooCommerce Payment Gateway #
lddPay is a custom WooCommerce payment gateway plugin that enables secure and seamless payment processing on your WooCommerce store.
Features #
- Secure payments through the lddPay API.
- Customizable payment gateway settings.
- Simple integration with WooCommerce.
- Display of a custom title, and description on the checkout page.
支持 #
For support or inquiries, please contact info@lddpay.com.
Guide #
Getting Started #
Prerequisites #
Before you begin integrating the lddPay Payment SDK into your application, ensure that you have the following prerequisites in place:
- Node.js: Version 12.x or later is required. You can download it from Node.js official site.
- npm: The Node package manager, which comes with Node.js. Ensure it is up to date by running:
npm install -g npm
- lddPay Dashboard Account: You need to sign up and create an account on the lddPay Dashboard to obtain your
CLIENT_KEY
andCLIENT_SECRET
.
Setting Up a lddPay Dashboard Account #
To use the lddPay Payment SDK, you need to create a lddPay Dashboard account and generate your API keys. Follow these steps:
- Navigate to the lddPay Dashboard: Open your web browser and go to the lddPay Dashboard.
- Verify Your Email Address: After signing up, you will receive a verification email.
Open the email and click on the verification link to activate your account. - Generate API Keys: After logging in, follow these steps to generate your API keys:
- Navigate to the API Keys section within the Dashboard.
- Click on Create API Key to begin the process.
- Customize your API Key by setting the following options:
- 姓名: Give your API Key a descriptive name for easy identification.
- Environment: Choose between Production or Test based on your needs.
- Expiry Date: Optionally, set an expiration date for the API Key if you want it to be time-bound.
- Currency Type: Select the currency type—either Fiat or Crypto—that the API Key will support.
- Webhooks: Configure the webhook URL(s) to receive real-time notifications of payment events. You can set up separate URLs for different environments or types of notifications (e.g., payment success, payment failure).
- Once configured, confirm your settings to generate the API Key.
- You will be provided with a
CLIENT_KEY
and aCLIENT_SECRET
. Ensure you store these securely, as they are essential for SDK configuration and should be treated with the highest level of security. - Additional Configuration (Optional): Explore the dashboard to configure additional settings, such as webhooks, payment providers, and regional settings.
Installation Guide #
Once you have your API keys, follow these steps to install the lddPay Payment SDK:
- Initialize Your Project (if you haven’t already):
mkdir my-payment-app
cd my-payment-app
npm init -y
Install the SDK:
npm i banksy-sdk --save
Verify Installation: Ensure the package is installed by checking your package.json
:
{
"dependencies": {
"banksy-sdk": "^1.0.0"
}
}
Setup and Initialization #
After installing the SDK, you need to set it up in your application. Follow these steps:
- Import and Initialize the SDK: In your main JavaScript file (e.g.,
index.js
,app.js
), import the SDK and initialize it with your CLIENT_KEY:import { Banksy } from "banksy-sdk";
const banksy = new Banksy("YOUR_CLIENT_KEY");
export default banksy;
Create a Helper File: To avoid multiple initializations of the SDK, it’s recommended to create a separate helper file (e.g., lddPay.js
):
// banksy.js
import { Banksy } from "banksy-sdk";
const banksyInstance = new banksy("YOUR_CLIENT_KEY");
export default banksyInstance;
Integrate into Your Application: Use the banksyInstance
in your components or services to manage payment operations. For example:
import banksy from './banksy';
async function createPayment(payload) {
try {
const paymentData = await banksy.createPayment(payload);
console.log("Payment Created: ", paymentData);
} catch (error) {
console.error("Error creating payment: ", error);
}
}
Quick Start Example #
Here’s a quick example to get you started with creating a payment:
- Create a Payment Payload:
const paymentPayload = {
amount: 100,
currency: "USD",
successCallback: "https://yourdomain.com/success",
failureCallback: "https://yourdomain.com/failure",
currencyType: "fiat",
isKycOptional: false
};
Create and Process the Payment:
import banksy from './banksy';
async function processPayment() {
try {
const paymentData = await banksy.createPayment(paymentPayload);
console.log("Payment Link: ", paymentData.paymentLink);
// Redirect user to the payment link
window.location.href = paymentData.paymentLink;
} catch (error) {
console.error("Payment failed: ", error);
}
}
processPayment();
API Key Generation #
1. Overview #
An API key is a unique identifier that allows you to interact with the platform’s API. Once an API key is created, you can use it to:
- Authenticate your API requests.
- Access platform services like transactions, data queries, and more.
The platform provides two types of environments for API keys:
- Test Mode: For testing and debugging.
- Production Mode: For live operations in the production environment.
2. Prerequisites #
Before generating an API key, ensure the following:
- You have access to your platform account.
- You understand whether the API key will be used for testing or production.
- Webhooks (if applicable) are properly set up to receive event notifications.
3. Generating an API Key #
Please refer to info@lddpay.com #
4. Managing Webhooks #
Webhooks allow the platform to notify your system of specific events such as transaction completions, balance changes, or other updates.
Steps for Adding Webhooks: #
- After the API key is created, you can configure Webhooks from the Webhooks section.
- Provide the endpoint URL where the platform should send event notifications.
- Select the event types that you want to be notified about.
- Save your webhook settings.
5. Using the API Key #
After creating the API key, you will receive:
- Public Key: A unique identifier for API requests. This key is used when sending requests to the platform.
- Secret Key: Used to sign requests and authenticate transactions securely. Keep this key private and never expose it publicly.
Public and Secret Key #
- The Public Key is included in your API requests as an identifier.
- The Secret Key is used to sign requests, ensuring authenticity and security.
Security Best Practices #
- Never share your Secret Key: Treat the secret key as a password; avoid exposing it in publicly accessible files or code.
- Use HTTPS: Always ensure that your API requests are sent over a secure connection.
- Rotate Keys Regularly: For enhanced security, periodically rotate your API keys and update your integrations accordingly.
6. Logs and Key Management #
View and Manage Logs: #
- Transaction Logs: After an API key is generated, you can track all API interactions in the Transaction Logs section. This includes successful requests, errors, and other relevant data.
- Webhook Logs: Any event triggered by the platform through a webhook will be recorded in the Webhook Logs.
Edit or Delete API Keys: #
From the API Keys section, you can edit existing keys or delete them if no longer in use. Always ensure proper key management to maintain the security of your integration.