Create Payment Request
Create a payment request for items in the user's basket.
Endpoint
Authentication
Required (User role)
Request Body
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
address_id |
integer | Yes | Shipping address ID |
price |
float | Yes | Total payment amount |
currency_id |
integer | Yes | Currency ID |
Response
Success (200 OK)
Production Mode:
Staging Mode:
Response Fields:
| Field | Type | Description |
|---|---|---|
redirect_url |
string | URL to redirect the user to the payment gateway (production) or success page (staging) |
status |
string | Payment request status ("success" or "error") |
Usage:
- In production mode: Redirect user to redirect_url (ePoint payment page)
- In staging mode: Redirect user to redirect_url (success page, payment already processed)
Error Responses
User Not Found (404)
Currency Not Found (404)
Empty Basket (400)
Example Request
curl -X POST "https://api.luxmart.site/v1/products/payment/" \
-H "Authorization: Token your_access_token" \
-H "Content-Type: application/json" \
-d '{
"address_id": 5,
"price": 199.98,
"currency_id": 1
}'
Notes
Production Mode (Default)
- Payment is processed through ePoint payment gateway
- Orders are created for each product variant in the basket
- Payment status is initially "Not completed" (status: "1")
- Orders are created with status "7" (Waiting) and payment_status "3" (Pending)
- After successful payment, callback endpoint updates order status
- Basket is cleared after successful payment
- User is redirected to ePoint payment page
Staging Mode
When ENVIRONMENT=staging is set:
- No ePoint API calls - Payment is processed immediately without external gateway
- Auto-approved payments - All payments are automatically marked as successful
- Immediate processing:
- Payment status set to "2" (Success) immediately
- Orders are initially created with status "7" (Waiting) and payment_status "3" (Pending), then immediately updated to status "1" (Incoming) and payment_status "1" (Success)
- Product stock quantities are decremented immediately
- User's basket is cleared immediately
- Sandbox transaction ID - Uses format
SANDBOX-{order_id}for tracking - Sandbox card number - Uses
SANDBOX-****1234as placeholder - Direct redirect - User is redirected directly to success page (no ePoint redirect)
- Full order flow - Complete order processing happens synchronously
Environment Configuration
The following environment variables control payment behavior:
ENVIRONMENT- Set to"staging"for sandbox mode,"production"(default) for real paymentsPAYMENT_SUCCESS_REDIRECT_URL- URL to redirect users after successful payment (default:https://luxmart.az/payment/success)PAYMENT_ERROR_REDIRECT_URL- URL to redirect users after failed payment (default:https://luxmart.az/payment/error)
Currency Conversion
- All prices are converted to AZN before sending to ePoint (production mode only)
- Original currency and amount are stored in payment records
- Currency conversion formula:
priceInAZN = price / currency.Value