mirror of
https://github.com/duhanbalci/iyzico.git
synced 2026-03-03 20:29:18 +00:00
81 lines
1.8 KiB
Markdown
81 lines
1.8 KiB
Markdown
# @iyzico/payment
|
|
|
|
TypeScript SDK for iyzico payment gateway.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npm install @iyzico/payment
|
|
```
|
|
|
|
## Usage
|
|
|
|
```typescript
|
|
import { IyzicoClient } from '@iyzico/payment';
|
|
|
|
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 payments
|
|
- `binCheck` - BIN number lookup
|
|
- `installment` - Installment options
|
|
- `cardStorage` - Save and manage cards
|
|
- `cancelRefund` - Cancellations and refunds
|
|
- `reporting` - Transaction reports
|
|
- `subscription` - 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
|