payment
Create Gkash web payment with recurring type
Initiate a new Gkash payment transaction with recurring type parameter. This endpoint: - Creates a payment record in the database - Generates payment form data with recurringtype parameter - Returns a payment URL (redirectUrl) and formData for redirecting the customer to Gkash payment page - Upon successful payment completion, Gkash will send a callback with an epkey - The epkey can be used for future recurring payments without requiring the customer to enter card details again
**Recurring Types:**
- ANNUAL: For annual subscriptions
- MONTHLY: For monthly subscriptions
- WEEKLY: For weekly subscriptions
- DAILY: For daily subscriptions
**Flow:**
1. Call this endpoint to create payment
2. Redirect customer to the returned redirectUrl with formData
3. Customer completes payment on Gkash page
4. Gkash sends callback to your callbackUrl with epkey
5. Use the epkey in recurring payment endpoint for future charges
**How to Redirect to Payment Page:**
After receiving the response, you need to create a form and auto-submit it:
```javascript
// JavaScript example
if (response.data.redirectUrl && response.data.formData) {
const form = document.createElement('form');
form.method = 'POST';
form.action = response.data.redirectUrl;
// Add all form fields
Object.keys(response.data.formData).forEach(key => {
const input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = response.data.formData[key];
form.appendChild(input);
});
document.body.appendChild(form);
form.submit(); // Redirects to Gkash payment page
}
```
See examples/gkash-payment-redirect-example.js for complete implementation.
post/payment/gkash/create
Request body
Example request
{
"transactionType": "RELOAD",
"amount": "100.00",
"currency": "MYR",
"prodDesc": "WOWlet Token Reload",
"userName": "John Doe",
"userEmail": "john.doe@example.com",
"userContact": "+60123456789",
"returnUrl": "https://example.com/return",
"callbackUrl": "https://example.com/callback",
"refNo": "merchant-reference-712893",
"memberID": "TWE-123456",
"walletID": "TWW-123456789012-1",
"documentID": "123456789012",
"remark": "Token Reload Transaction",
"v_billemail": "billing@example.com",
"v_billphone": "+60123456789"
}Response
Gkash payment created successfully. Response includes redirectUrl and formData for redirecting customer to Gkash payment page.
Example response
{
"success": true,
"message": "Payment created successfully",
"data": {
"paymentId": 123,
"refNo": "16twtopup34567890123",
"status": "success",
"amount": 50,
"currency": "MYR",
"transactionType": "RELOAD",
"ipay88TransId": "IP88TXN123",
"ipay88AuthCode": "AUTH123",
"ipay88Status": "1",
"cardDetails": {
"last4": "1234",
"cardType": "VISA",
"cardHolderName": "JOHN DOE",
"expiryMonth": "12",
"expiryYear": "2025",
"issuingBank": "MAYBANK",
"issuingCountry": "MY"
},
"memberId": "TWE-123456",
"walletId": "TWW-123456789012-1",
"gkashStatus": "88 - Transferred",
"gkashTransId": "M161-P0-999999",
"gkashPaymentType": "Master Credit 0008"
}
}Changes
No recorded changes to this endpoint across all 1 revision of this API.