Skip to main content

Stripe

Overview

Stripe is a leading payment provider that enables businesses to accept payments globally in 135+ currencies. It provides robust payment processing capabilities with support for various payment methods and comprehensive API integration options.

Stripe Logo

Features

  • Support for 135+ currencies worldwide
  • Multiple payment method support
  • Secure payment processing
  • Detailed reporting and analytics
  • Webhook notifications

Integration Requirements

  • Banksy API Key
  • Valid callback URLs for success and failure scenarios
  • Customer email for transaction notifications

Supported Currencies

Major Currencies
  • USD (United States Dollar)
  • EUR (Euro)
  • GBP (British Pound)
  • JPY (Japanese Yen)
  • AUD (Australian Dollar)
  • CAD (Canadian Dollar)
  • CHF (Swiss Franc)
  • And 135+ more currencies

Special Currency Considerations

Zero-decimal Currencies

The following currencies don't use decimal points:

  • BIF (Burundian Franc)
  • CLP (Chilean Peso)
  • DJF (Djiboutian Franc)
  • JPY (Japanese Yen)
  • KRW (South Korean Won)
  • PYG (Paraguayan Guaraní)
  • VND (Vietnamese Đồng)
  • XAF (Central African CFA Franc)
  • XOF (West African CFA Franc)
  • XPF (CFP Franc)

Accepted Payment Methods

  • Credit & Debit Cards
    • Visa
    • Mastercard
    • American Express
    • Discover
    • Diners Club
    • JCB
    • UnionPay

Implementation

Payment Payload Structure

const payload = {
amount: number, // Payment amount
currency: string, // Currency code (USD/GBP/EUR)
currencyType: "stripe", // Fixed value for fiat transactions
isKycOptional: boolean, // Whether KYC is required
customerEmail: string, // Customer's email address
successCallback: string, // URL for successful payments
failureCallback: string, // URL for failed payments
};

Example Implementation

import { Banksy } from "banksy-sdk";

// Initialize the Banksy SDK with your API key
const banksy = new Banksy("your-api-key");

async function createStripePayment() {
try {
const paymentPayload = {
amount: 100,
currency: "USD",
currencyType: "stripe",
isKycOptional: true,
customerEmail: "customer@example.com",
successCallback: "https://your-domain.com/success",
failureCallback: "https://your-domain.com/failure",
};

const payment = await banksy.createPayment(paymentPayload);
console.log("Payment Created:", payment);

// Redirect to payment page
window.location.href = payment.paymentLink;
} catch (error) {
console.error("Payment creation failed:", error);
}
}

Example with KYC Required

import { Banksy } from "banksy-sdk";

const banksy = new Banksy("your-api-key");

async function createStripePaymentWithKYC() {
try {
const paymentPayload = {
amount: 1000,
currency: "GBP",
currencyType: "stripe",
isKycOptional: false, // KYC will be required
successCallback: "https://your-domain.com/success",
failureCallback: "https://your-domain.com/failure",
};

const payment = await banksy.createPayment(paymentPayload);
console.log("Payment Created:", payment);

// Redirect to payment page with KYC flow
window.location.href = payment.paymentLink;
} catch (error) {
console.error("Payment creation failed:", error);
}
}

Testing

  1. Use test API keys for development
  2. Test with different currency combinations
  3. Verify callback handling for both success and failure scenarios
  4. Test KYC flows when isKycOptional is set to false

API Testing with cURL

You can test the payment creation endpoint using the following cURL command:

curl --location 'https://sandbox-api.banksy.id/sdk/payment/create' \
--header 'Content-Type: application/json' \
--header 'X-AUTH: ck_test_************738139' \
--data-raw '{
"amount": 100,
"currency": "GBP",
"currencyType": "stripe",
"isKycOptional": true,
"customerEmail": "parth@gmail.com",
"successCallback": "http://domain.com/success",
"failureCallback": "http://domain.com/failure"
}'

Test Cards

For testing payments in the development environment, you can use the following test card:

Card Number: 4242 4242 4242 4242
CVV: Any 3 digits
Expiry: Any future date

This test card will always result in successful payments.

Security Considerations

  • Always use HTTPS for API calls
  • Validate all input parameters
  • Store sensitive data securely
  • Implement proper authentication for callback endpoints
  • Monitor transactions for suspicious activity

Best Practices

  1. Amount Validation

    • Ensure the amount is a positive number
    • Validate against minimum and maximum transaction limits
    • Use proper decimal handling for different currencies
  2. Currency Handling

    • Always verify the currency is supported before creating the payment
    • Use proper currency formatting based on the selected currency
    • Consider exchange rate implications for international transactions
  3. Callback URLs

    • Use HTTPS for callback URLs
    • Implement proper validation in callback endpoints
    • Handle both success and failure scenarios gracefully
  4. Error Handling

    • Implement comprehensive error handling
    • Log all payment attempts and responses
    • Provide clear error messages to users

Support

For technical support or integration assistance, please contact the Banksy support team through the official channels.