A Node.js payment service that integrates with the Iyzico payment gateway. This service provides endpoints for payment processing, refunds, cancellations, and payment details.
- Clone the repository
- Install dependencies:
npm install- Create a
.envfile with the following variables:
IYZICO_BASE_URL=<your_iyzico_api_url>
IYZICO_API_KEY=<your_api_key>
IYZICO_SECRET_KEY=<your_secret_key>
PORT=5000- POST
/payment - Processes a new payment transaction
- Required fields:
- paymentChannel
- installment
- currency
- customer details (id, name, surname, email, phone, etc.)
- basketItems (id, name, price, category1)
- paymentCard details (cardHolderName, cardNumber, expireMonth, expireYear, cvc)
- GET
/payment - Retrieves payment details
- Required fields:
- paymentId
- ip
- conversationId
- POST
/payment/refund - Processes a refund for a payment
- Required fields:
- paymentTransactionId
- price
- conversationId
- POST
/payment/cancel - Cancels a payment
- Required fields:
- paymentId
- conversationId
All endpoints return appropriate HTTP status codes:
- 200: Successful operation
- 400: Bad request (missing or invalid parameters)
- 500: Server error
Error responses include:
{
"errorCode": "ERROR_CODE",
"errorMessage": "Detailed error message"
}- CORS enabled
- Request logging with Morgan
- Input validation for all endpoints