Installation
Install better-payment and set up your environment.
Requirements
- Node.js
>= 20.0.0 - TypeScript
>= 5.0(recommended)
The server entry point (better-payment) uses node:crypto and does not run on edge runtimes such as Vercel Edge or Cloudflare Workers. Use the Node.js runtime for your payment routes. better-payment/client is browser-safe.
Install
npm install better-paymentpnpm add better-paymentyarn add better-paymentbun add better-paymentEnvironment 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, VERSION } from 'better-payment';
const payment = new BetterPayment({
mode: 'sandbox',
providers: {
iyzico: {
enabled: true,
config: { apiKey: 'test', secretKey: 'test' },
},
},
});
console.log(VERSION, payment.getEnabledProviders()); // '0.0.1' ['iyzico']