Open Source · TypeScript · Node.js 20+

One API for all payment
gateways

better-payment unifies İyzico, PayTR, and Parampos under a single, type-safe API. Stop rewriting payment logic — write it once, use it everywhere.

$npm install better-payment
3Providers
1Dependency
100%TypeScript
Features

Everything you need

Designed to be framework-agnostic and production-ready from day one.

Core

Unified API

One consistent interface across all payment providers. Switch providers without rewriting your integration logic.

DX

Full TypeScript

Complete type definitions out of the box. Catch payment errors at compile time, not in production.

Performance

Minimal Footprint

Only requires axios as a dependency. Keep your bundle lean and your dependency tree clean.

Security

Secure by Default

API key and secret key encryption built in. 3D Secure support across all providers from day one.

Billing

Recurring Payments

Built-in subscription and recurring payment support. Handle installment inquiries with ease.

Payments

Multiple Methods

Standard card, 3D Secure, EFT/IBAN transfer, hosted checkout, and installment options.

Integrations

Supported providers

Leading Turkish payment gateways, all unified under one API.

IY

İyzico

Turkey's leading payment gateway with extensive feature support.

  • V2 Authorization
  • Checkout Form
  • Subscription Payments
  • Installment Inquiry
  • 3D Secure
PT

PayTR

Popular

Fast and reliable payment processing with competitive rates.

  • Card Payments
  • 3D Secure
  • Hosted Checkout
  • Installments
  • IBAN Transfer
PP

Parampos

Enterprise-grade payment solution with SOAP API and advanced features.

  • SOAP API
  • 3D Secure
  • Installments
  • Refund & Cancellation
  • Direct API
Quick Start

Up and running in minutes

Three steps to integrate any payment provider.

01

Install the package

terminal
npm install better-payment
02

Configure your providers

lib/payment.ts
import { BetterPayment } from "better-payment";

const payment = new BetterPayment({
  defaultProvider: "iyzico",
  providers: {
    iyzico: {
      enabled: true,
      apiKey: process.env.IYZICO_API_KEY!,
      secretKey: process.env.IYZICO_SECRET_KEY!,
      baseUrl: "https://sandbox-api.iyzipay.com",
    },
    paytr: {
      enabled: true,
      merchantId: process.env.PAYTR_MERCHANT_ID!,
      merchantKey: process.env.PAYTR_MERCHANT_KEY!,
      merchantSalt: process.env.PAYTR_MERCHANT_SALT!,
    },
  },
});

export default payment;
03

Create your first payment

app/checkout.ts
import payment from "@/lib/payment";

// Uses the default provider (iyzico)
const result = await payment.createPayment({
  price: "100.00",
  currency: "TRY",
  buyer: {
    id: "user-123",
    name: "John",
    surname: "Doe",
    email: "john@example.com",
    identityNumber: "11111111111",
    ip: "85.34.78.112",
  },
  basketItems: [
    {
      id: "item-1",
      name: "Premium Plan",
      price: "100.00",
      category: "Subscription",
    },
  ],
  billingAddress: {
    contactName: "John Doe",
    city: "Istanbul",
    country: "Turkey",
    address: "Nispetiye Cd. Akmerkez B Blok",
  },
});

// Or switch provider on the fly
const result2 = await payment.use("paytr").createPayment({ ... });

Ready to simplify payments?

Join developers who stopped duplicating payment logic across providers.