One API.
Three providers.
Zero repetition.
better-payment unifies İyzico, PayTR, and Parampos under a single type-safe interface. Switch providers without rewriting your integration.
Works with any Node.js framework
The Problem
Every gateway has a
completely different API.
Switching providers means rewriting your entire payment stack — different request shapes, different error codes, different auth flows. better-payment eliminates that entirely.
Features
Everything you need,
nothing you don't.
Unified API surface
One consistent method set across every provider. createPayment, refund, cancel — all providers respond the same way.
100% TypeScript
Full type definitions shipped out of the box. Catch payment errors at compile time, not in production.
Minimal dependencies
Only axios as a peer dependency. Keeps your bundle lean and your dependency tree clean.
Secure by default
HMAC-SHA256 signature validation, 3D Secure support, and no credential exposure in transport.
Auto HTTP handler
BetterPaymentHandler turns your config into a full REST API with zero boilerplate — drop-in for Next.js or Express.
Multi-provider switching
Configure all providers upfront, then switch at runtime with payment.use("paytr"). A/B test gateways without code changes.
All payment methods
Card, 3DS, EFT/IBAN, hosted checkout, installments, subscriptions — fully unified across the provider surface.
Subscription billing
İyzico subscription APIs — product creation, pricing plans, card update — all available through the unified handler.
Supported Providers
Three gateways,
one integration.
İyzico
Turkey's leading gateway
Full-featured integration covering V2 auth, hosted checkout, PWI (IBAN payments), subscriptions, BIN check, and installment inquiry.
Capabilities
- V2 Auth & 3D Secure
- Hosted Checkout Form
- PWI (IBAN/EFT Payments)
- Subscription & Recurring
- BIN Check & Installments
- Card Tokenization
Example usage
// Checkout form (hosted payment page)
const result = await payment.use("iyzico")
.initCheckoutForm({
price: "100.00", currency: "TRY",
callbackUrl: "https://yoursite.com/callback",
buyer: { ... },
basketItems: [ ... ]
});Direct Bank Integrations
Native bank APIs,
zero abstraction cost.
Direct integrations with Turkish bank virtual POS systems — no third-party gateway, full control over your settlement.
Akbank
Sanal POS · Direct Integration
Direct integration with Akbank's Virtual POS API. OAuth2 token authentication, HMAC-signed requests, and full support for both 2D and 3D Secure payment flows — no intermediary gateway.
OAuth2 Auth
Token-based authentication
2D & 3D Secure
Both flows supported
Hash Verified
HMAC request signing
Direct API
No third-party middleware
Integration example
import { BetterPayment } from "better-payment";
const payment = new BetterPayment({
providers: {
akbank: {
enabled: true,
config: {
merchantId: process.env.AKBANK_MERCHANT_ID!,
terminalId: process.env.AKBANK_TERMINAL_ID!,
storeKey: process.env.AKBANK_STORE_KEY!,
baseUrl: "https://apiprod.akbank.com",
},
},
},
});
// 3D Secure initialization
const init = await payment.akbank.initThreeDSPayment({
price: "250.00",
currency: "TRY",
callbackUrl: "https://yoursite.com/akbank/callback",
paymentCard: { ... },
buyer: { ... },
});
// Complete in callback route
const result = await payment.akbank
.completeThreeDSPayment({ paymentId: body.paymentId });More banks coming soon
Quick Start
Up and running
in minutes.
Install the package
$ npm install better-paymentConfigure your providers
import { BetterPayment, ProviderType } from "better-payment";
const payment = new BetterPayment({
defaultProvider: ProviderType.IYZICO,
providers: {
iyzico: {
enabled: true,
config: {
apiKey: process.env.IYZICO_API_KEY!,
secretKey: process.env.IYZICO_SECRET_KEY!,
baseUrl: process.env.IYZICO_BASE_URL!,
},
},
},
});
export default payment;Process your first payment
import payment from "@/lib/payment";
// Unified API — works identically for every provider
const result = await payment.createPayment({
price: "100.00",
currency: "TRY",
buyer: { id: "usr-123", ... },
basketItems: [ ... ],
});
// Or switch to a different provider at runtime
const checkout = await payment.use("paytr").initThreeDSPayment({ ... });Open Source · MIT License
Stop rewriting
payment logic.
One package, three providers, full TypeScript support. Install once and unify your entire Turkish payment stack.