mirror of
https://github.com/duhanbalci/iyzico.git
synced 2026-03-03 20:29:18 +00:00
1.8 KiB
1.8 KiB
@duhanbalci/iyzico-sdk
TypeScript SDK for iyzico payment gateway.
Installation
npm install @duhanbalci/iyzico-sdk
Usage
import { IyzicoClient } from '@duhanbalci/iyzico-sdk';
const client = new IyzicoClient({
apiKey: 'your-api-key',
secretKey: 'your-secret-key',
baseUrl: 'https://sandbox-api.iyzipay.com', // optional, defaults to sandbox
});
// Create a payment
const payment = await client.payment.create({
price: '100.00',
paidPrice: '100.00',
currency: 'TRY',
installment: 1,
basketId: 'B12345',
paymentCard: {
cardHolderName: 'John Doe',
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvc: '123',
},
buyer: { /* ... */ },
shippingAddress: { /* ... */ },
billingAddress: { /* ... */ },
basketItems: [ /* ... */ ],
});
// Check BIN
const binInfo = await client.binCheck.check({ binNumber: '552879' });
// Get installment options
const installments = await client.installment.check({
binNumber: '552879',
price: '100.00',
});
Services
payment- 3DS and Non-3DS paymentsbinCheck- BIN number lookupinstallment- Installment optionscardStorage- Save and manage cardscancelRefund- Cancellations and refundsreporting- Transaction reportssubscription- Subscription management
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | - | API key (required) |
| secretKey | string | - | Secret key (required) |
| baseUrl | string | sandbox | API base URL |
| locale | 'tr' | 'en' | 'tr' | Response locale |
| retryOnRateLimit | boolean | false | Retry on 429 |
| maxRetries | number | 3 | Max retry attempts |
Requirements
- Node.js 18+
- TypeScript 5.0+ (recommended)
License
MIT