SDKs & Plugins
Official server-side SDKs and plugins for every major stack. All wrap the
Payments
and Customers
APIs and include webhook signature verification. API keys are secret — never use them in browser code.
Make sure the key you configure has the abilities
the SDK calls need (e.g. payments:write to create payments, payments:refund to refund) —
calls with an under-scoped or expired key return 403 ability_denied / 401 authentication_error.
Pass customer_id when creating a payment to attach it to a customer you already
created — see Payments API.
PHP — fastaar/fastaar-php
composer require fastaar/fastaar-php
use Fastaar\FastaarClient;
use Fastaar\WebhookSignature;
$fastaar = new FastaarClient(getenv('FASTAAR_API_KEY'));
// Create payment and redirect
$payment = $fastaar->createPayment([
'amount' => 1250,
'invoice_number' => 'ORDER-42',
'customer_id' => $customer['id'] ?? null, // optional — attach an existing customer
'success_url' => 'https://shop.example.com/thanks',
'cancel_url' => 'https://shop.example.com/cart',
]);
header('Location: ' . $payment['checkout_url']);
exit;
// Confirm from webhook
$rawBody = file_get_contents('php://input');
$sig = $_SERVER['HTTP_X_FASTAAR_SIGNATURE'] ?? '';
$valid = WebhookSignature::verify(getenv('FASTAAR_WEBHOOK_SECRET'), $rawBody, $sig);
// Refund (in full, or pass an amount to refund only part of it)
$payment = $fastaar->refundPayment($payment['id']);
$partial = $fastaar->refundPayment($payment['id'], 200);
$refunds = $fastaar->listRefunds($payment['id']); // full refund history, newest first
// Customers
$customer = $fastaar->createCustomer(['name' => 'Rahim Uddin', 'phone' => '01512345678']);
$customer = $fastaar->getCustomer($customer['id']);
$customer = $fastaar->updateCustomer($customer['id'], ['name' => 'Rahim Ahmed']);
$customers = $fastaar->listCustomers(['email' => 'rahim@example.com']);
Requires PHP 8.1+.
Laravel — fastaar/fastaar-laravel
composer require fastaar/fastaar-laravel
// config/fastaar.php → FASTAAR_API_KEY in .env
use Fastaar\Laravel\Facades\Fastaar;
// Create payment and redirect
$payment = Fastaar::createPayment([
'amount' => 1250,
'invoice_number' => 'ORDER-42',
'customer_id' => $customer['id'] ?? null, // optional — attach an existing customer
'success_url' => route('checkout.thanks'),
]);
return redirect($payment['checkout_url']);
// Webhook route (signature verified by middleware)
Route::post('/webhooks/fastaar', FastaarWebhookController::class)
->middleware('fastaar.webhook');
// Refund (in full, or pass an amount to refund only part of it)
$payment = Fastaar::refundPayment($payment['id']);
$partial = Fastaar::refundPayment($payment['id'], 200);
$refunds = Fastaar::listRefunds($payment['id']); // full refund history, newest first
// Customers
$customer = Fastaar::createCustomer(['name' => 'Rahim Uddin', 'phone' => '01512345678']);
$customer = Fastaar::getCustomer($customer['id']);
$customers = Fastaar::listCustomers(['email' => 'rahim@example.com']);
Auto-discovers via Laravel package discovery. Requires Laravel 10+ / PHP 8.1+. It's a facade over fastaar-php, so it accepts the same createPayment params — including customer_id — with no separate versioning.
Node.js — @fastaar/node
npm install @fastaar/node
import { FastaarClient, verifyWebhookSignature } from '@fastaar/node';
const fastaar = new FastaarClient(process.env.FASTAAR_API_KEY);
// Create payment and redirect
const payment = await fastaar.createPayment({
amount: 1250,
invoice_number: 'ORDER-42',
customer_id: customer?.id, // optional — attach an existing customer
success_url: 'https://shop.example.com/thanks',
});
res.redirect(payment.checkout_url);
// Confirm from webhook (pass RAW body)
app.post('/webhooks/fastaar', express.raw({ type: 'application/json' }), (req, res) => {
const valid = verifyWebhookSignature(
process.env.FASTAAR_WEBHOOK_SECRET,
req.body,
req.header('X-Fastaar-Signature'),
);
if (!valid) return res.sendStatus(400);
const event = JSON.parse(req.body);
res.sendStatus(200);
});
// Refund (in full, or pass an amount to refund only part of it)
const refunded = await fastaar.refundPayment(payment.id);
const partial = await fastaar.refundPayment(payment.id, 200);
const refunds = await fastaar.listRefunds(payment.id); // full refund history, newest first
// Customers
const customer = await fastaar.createCustomer({ name: 'Rahim Uddin', phone: '01512345678' });
const fetched = await fastaar.getCustomer(customer.id);
const customers = await fastaar.listCustomers({ email: 'rahim@example.com' });
ES module; zero dependencies; requires Node 18+.
Next.js — @fastaar/nextjs
npm install @fastaar/nextjs
// Server Action
import { getFastaarClient } from '@fastaar/nextjs';
import { redirect } from 'next/navigation';
const fastaar = getFastaarClient(); // reads FASTAAR_API_KEY from env
const payment = await fastaar.createPayment({
amount: 1250,
invoice_number: 'ORDER-42',
customer_id: customer?.id, // optional — attach an existing customer
success_url: 'https://shop.example.com/thanks',
});
redirect(payment.checkout_url);
// Route Handler — app/api/webhooks/fastaar/route.ts
import { verifyNextWebhook } from '@fastaar/nextjs';
import { NextResponse } from 'next/server';
export async function POST(req: Request) {
const { isValid, event } = await verifyNextWebhook(req);
if (!isValid || !event) return new NextResponse('Invalid signature', { status: 400 });
if (event.event === 'payment.completed') {
const { id, invoice_number } = event.data;
// mark order paid...
}
return new NextResponse('OK');
}
// Refund (in full, or pass an amount to refund only part of it)
const refunded = await fastaar.refundPayment(payment.id);
const partial = await fastaar.refundPayment(payment.id, 200);
const refunds = await fastaar.listRefunds(payment.id); // full refund history, newest first
// Customers
const customer = await fastaar.createCustomer({ name: 'Rahim Uddin', phone: '01512345678' });
const fetched = await fastaar.getCustomer(customer.id);
const customers = await fastaar.listCustomers({ email: 'rahim@example.com' });
Supports App Router, React Server Components, Server Actions, and Route Handlers. Full TypeScript support.
Python — fastaar-python
pip install fastaar-python
import os
from fastaar import FastaarClient, WebhookSignature
fastaar = FastaarClient(os.getenv('FASTAAR_API_KEY'))
# Create payment and redirect
payment = fastaar.create_payment({
'amount': 1250,
'invoice_number': 'ORDER-42',
'customer_id': customer['id'] if customer else None, # optional — attach an existing customer
'success_url': 'https://shop.example.com/thanks',
})
# redirect to payment['checkout_url']
# Confirm from webhook
valid = WebhookSignature.verify(
os.getenv('FASTAAR_WEBHOOK_SECRET'),
raw_body,
request.headers.get('X-Fastaar-Signature', ''),
)
# Refund (in full, or pass an amount to refund only part of it)
payment = fastaar.refund_payment(payment['id'])
partial = fastaar.refund_payment(payment['id'], 200)
refunds = fastaar.list_refunds(payment['id']) # full refund history, newest first
# Customers
customer = fastaar.create_customer({'name': 'Rahim Uddin', 'phone': '01512345678'})
customer = fastaar.get_customer(customer['id'])
customers = fastaar.list_customers({'email': 'rahim@example.com'})
Zero dependencies; uses Python's standard library. Requires Python 3.8+.
Django — fastaar-django
pip install fastaar-django
# settings.py
INSTALLED_APPS = [..., 'fastaar_django']
FASTAAR_API_KEY = os.getenv('FASTAAR_API_KEY')
FASTAAR_WEBHOOK_SECRET = os.getenv('FASTAAR_WEBHOOK_SECRET')
# urls.py
from fastaar_django.urls import urlpatterns as fastaar_urls
urlpatterns += fastaar_urls
# Listen for the payment.completed signal
from fastaar_django.signals import payment_completed
@receiver(payment_completed)
def on_paid(sender, invoice_number, payment_id, data, **kwargs):
# mark order paid idempotently
...
# Payments, customers & refunds (via the underlying FastaarClient)
from fastaar_django import get_fastaar_client
fastaar = get_fastaar_client()
customer = fastaar.create_customer({'name': 'Rahim Uddin', 'phone': '01512345678'})
payment = fastaar.create_payment({
'amount': 1250,
'invoice_number': 'ORDER-42',
'customer_id': customer['id'], # optional — attach an existing customer
})
# Refund (in full, or pass an amount to refund only part of it)
payment = fastaar.refund_payment(payment_id)
partial = fastaar.refund_payment(payment_id, 200)
refunds = fastaar.list_refunds(payment_id) # full refund history, newest first
Wraps fastaar-python; includes CSRF-exempt webhook views with signature verification and Django signals. Since it calls create_payment() directly, it accepts the same params — including customer_id — with no separate versioning.
WordPress / WooCommerce plugin
Install the Fastaar Payment Gateway plugin to accept bKash, Nagad, Rocket, and Upay at checkout.
- Download
fastaar-pay.zipfrom the latest GitHub release. - In WordPress admin go to Plugins → Add New → Upload Plugin and upload the zip.
- Activate the plugin, then go to WooCommerce → Settings → Payments → Fastaar and enter your API key and webhook secret.
Requires WordPress 6.0+, WooCommerce, and PHP 8.1+. Webhook signatures are verified
automatically. The plugin creates payments from the WooCommerce order only (amount and
order ID) — it doesn't create or attach a
Fastaar customer,
so customer_id isn't set on payments made through checkout.
Refunding an order from WooCommerce → Orders supports partial refunds — refund the full order, a custom amount, or individual line items, and WooCommerce passes that amount straight through to Fastaar. Refunding less than the full amount marks the Fastaar payment partially refunded rather than refunded, and it can be refunded again later for the remaining balance.
Other languages
Not using any of the above? The API is plain HTTPS + JSON — see the integration guide for raw cURL examples and the webhooks page for the signature scheme.