Installation
Install payfyio and set up your environment.
Requirements
- Node.js
>= 20.0.0 - TypeScript
>= 5.0(recommended)
Install
npm install payfyiopnpm add payfyioyarn add payfyiobun add payfyioEnvironment Variables
Create a .env.local file (or .env) with your provider credentials:
# İyzico
IYZICO_API_KEY=your-api-key
IYZICO_SECRET_KEY=your-secret-key
IYZICO_BASE_URL=https://sandbox-api.iyzipay.com
# PayTR
PAYTR_MERCHANT_ID=your-merchant-id
PAYTR_MERCHANT_KEY=your-merchant-key
PAYTR_MERCHANT_SALT=your-merchant-salt
# Akbank
AKBANK_CLIENT_ID=your-client-id
AKBANK_CLIENT_SECRET=your-client-secret
AKBANK_MERCHANT_SAFE_ID=your-merchant-safe-id
# Parampos
PARAMPOS_CLIENT_CODE=your-client-code
PARAMPOS_CLIENT_USERNAME=your-username
PARAMPOS_CLIENT_PASSWORD=your-passwordNever commit API keys to version control. Use environment variables and ensure .env is in your .gitignore.
Verify Installation
import { Payfyio } from 'payfyio';
const payment = new Payfyio({
providers: {
iyzico: {
enabled: true,
config: {
apiKey: 'test',
secretKey: 'test',
baseUrl: 'https://sandbox-api.iyzipay.com',
},
},
},
});
console.log(payment.getEnabledProviders()); // ['iyzico']