Installation
Install Better Payment and set up your environment.
Requirements
- Node.js
>= 20.0.0, or an edge runtime: Vercel Edge, Cloudflare Workers, Deno or Bun - TypeScript
>= 5.0(recommended)
better-payment has no runtime dependencies. It only uses fetch and WebCrypto, so the same package runs on Node.js and on edge runtimes. better-payment/client is browser-safe.
Install
npm install better-paymentBeta release
New providers, plugins and features come out as a beta first (for example 0.12.0-beta.1), on the npm beta tag. Pages marked Beta describe them. To try them, install the beta:
npm install better-payment@betaThe beta can change before its stable release. Pin the exact version in production, and see the changelog before updating.
Environment Variables
Create a .env.local file (or .env) with your provider credentials:
# iyzico
IYZICO_API_KEY=your-api-key
IYZICO_SECRET_KEY=your-secret-key
# PayTR (Mağaza Paneli > Bilgi)
PAYTR_MERCHANT_ID=your-merchant-id
PAYTR_MERCHANT_KEY=your-merchant-key
PAYTR_MERCHANT_SALT=your-merchant-salt
# Akbank Sanal POS
AKBANK_MERCHANT_SAFE_ID=your-merchant-safe-id
AKBANK_TERMINAL_SAFE_ID=your-terminal-safe-id
AKBANK_SECRET_KEY=your-secret-key
# Parampos
PARAMPOS_CLIENT_CODE=your-client-code
PARAMPOS_CLIENT_USERNAME=your-username
PARAMPOS_CLIENT_PASSWORD=your-password
PARAMPOS_GUID=your-guidNever commit credentials to version control. Keep them in environment variables and make sure .env is in your .gitignore.
Verify Installation
import { betterPayment, iyzico, VERSION } from 'better-payment';
const payment = betterPayment({
mode: 'sandbox',
providers: {
iyzico: iyzico({ apiKey: 'test', secretKey: 'test' }),
},
});
console.log(VERSION, payment.getEnabledProviders()); // '0.11.0' ['iyzico']