SDKs & Libraries (STILL IN DEVELOPMENT!)
Official SDKs for popular programming languages.
JavaScript SDK
Installation
npm install zendfi-sdk
Basic Usage
import { ZendFi } from "zendfi-sdk"
const zendfi = new ZendFi("YOUR_API_KEY")
// Create a transfer
const transfer = await zendfi.transfer({
amount: 500,
from: "USD",
to: "NGN",
recipient: "0123456789",
description: "Payment"
})
console.log(transfer.status)
console.log(transfer.id)Features
- Full TypeScript support with auto-completion
- Promise-based API
- Automatic error handling
- Request retry logic
- Webhook signature verification
Python SDK
Installation
pip install zendfi
Basic Usage
from zendfi import ZendFi
zendfi = ZendFi("YOUR_API_KEY")
# Create a transfer
transfer = zendfi.transfer(
amount=500,
from_currency="USD",
to_currency="NGN",
recipient="0123456789",
description="Payment"
)
print(transfer.status)
print(transfer.id)Features
- Full type hints for IDE support
- Async/await support
- Built-in rate limiting
- Comprehensive error handling
- Webhook event parsing
Go SDK
Installation
go get github.com/zendfi/zendfi-go
Basic Usage
package main
import (
"fmt"
"github.com/zendfi/zendfi-go"
)
func main() {
client := zendfi.NewClient("YOUR_API_KEY")
transfer, err := client.Transfer(&zendfi.TransferRequest{
Amount: 500,
From: "USD",
To: "NGN",
Recipient: "0123456789",
})
if err != nil {
panic(err)
}
fmt.Println(transfer.Status)
}Features
- Strongly typed API
- Context support for cancellation
- Connection pooling
- Comprehensive logging
- Webhook signature verification
Common Patterns
Error Handling (JavaScript)
try {
const transfer = await zendfi.transfer({
amount: 500,
from: "USD",
to: "NGN",
recipient: "0123456789"
})
} catch (error) {
if (error.code === "INSUFFICIENT_BALANCE") {
console.error("Not enough balance")
} else if (error.code === "INVALID_RECIPIENT") {
console.error("Invalid recipient")
} else {
console.error("Transfer failed:", error.message)
}
}Webhook Verification (JavaScript)
import { ZendFi } from "zendfi-sdk"
const zendfi = new ZendFi("YOUR_API_KEY")
// Verify webhook signature
const isValid = zendfi.verifyWebhookSignature(
payload,
signature,
"YOUR_WEBHOOK_SECRET"
)
if (isValid) {
console.log("Webhook is authentic")
// Process webhook
} else {
console.error("Invalid webhook signature")
}Need Help?
Check the Getting Started guide or visit our API Reference for more details.