This document outlines the backend API endpoints required for SSLCommerz payment integration.
Endpoint: POST /ssl/initiate-payment
Request Body:
{
"parcelId": "string",
"amount": "number",
"customerName": "string",
"customerEmail": "string",
"customerPhone": "string",
"customerAddress": "string",
"productName": "string",
"productCategory": "string"
}Response:
{
"success": true,
"paymentUrl": "https://sandbox.sslcommerz.com/gwprocess/v4/gw.php?sessionkey=...",
"sessionKey": "string"
}Endpoint: POST /ssl/verify-payment
Request Body:
{
"transactionId": "string",
"valId": "string",
"parcelId": "string"
}Response:
{
"success": true,
"transactionId": "string",
"amount": "number",
"status": "VALID"
}-
Get SSLCommerz Credentials:
- Store ID
- Store Password
- API URL (Sandbox: https://sandbox.sslcommerz.com, Live: https://securepay.sslcommerz.com)
-
Initiate Payment:
- Create session using SSLCommerz API
- Generate payment URL
- Return URL to frontend
-
Success/Failure Callback:
- SSLCommerz will redirect to success/failure URL
- Verify payment using
val_idandtran_id - Update parcel payment status
- Create payment record
-
IPN (Instant Payment Notification):
- SSLCommerz will send IPN to your server
- Verify and process payment
SSL_STORE_ID=your_store_id
SSL_STORE_PASSWORD=your_store_password
SSL_API_URL=https://sandbox.sslcommerz.com (for testing)
SSL_SUCCESS_URL=https://yourdomain.com/dashboard/payment/success
SSL_FAIL_URL=https://yourdomain.com/dashboard/payment/fail
SSL_CANCEL_URL=https://yourdomain.com/dashboard/payment/cancel
SSL_IPN_URL=https://yourdomain.com/api/ssl/ipn- User selects SSL payment method
- Frontend calls
/ssl/initiate-payment - Backend creates SSL session and returns payment URL
- User is redirected to SSLCommerz payment page
- User completes payment
- SSLCommerz redirects to success/failure URL
- Frontend calls
/ssl/verify-paymentto verify - Backend verifies and updates payment status
- Use SSLCommerz sandbox for testing
- Switch to live URL for production
- Always verify payments server-side
- Handle IPN for reliable payment confirmation
- Store transaction IDs for reference