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.
Payload Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount | number | Yes | Amount to be charged |
currency | string | Yes | Currency in which the amount to be charged |
currencyType | "crypto" | "fiat" | Yes | Currency type. Valid values are "fiat" or "crypto" |
provider | string | No | Specify payment provider |
customerName | string | No | Customer name |
successCallback | string | Yes | On payment success portal will be redirected to this url |
failureCallback | string | Yes | On payment failure portal will be redirected to this url |
externalClientId | string | No | External client id, you will receive this on webhook |
isKycOptional | boolean | Yes | Indicates if KYC is optional. Must be true |
customerEmail | string | Yes | Customer's email (required if isKycOptional is true). |
customerPhone | string | Yes | Customer's phone number (required if isKycOptional is true). |
context | any | No | Any extra context JSON data, you will receive this on webhook |
Steps to Implement Payment Without KYC
1. Initialize the Banksy 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.