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

transactionType'RELOAD' | 'PURCHASE' | 'SUBSCRIPTION' | 'TOPUP' | 'OTHER' required

Transaction type

amountstring required

Payment amount (min 1.00)

currencystring required

Currency code

prodDescstring required

Product description

userNamestring required

User name

userEmailstring required

User email

userContactstring required

User contact number

recurringType'ANNUAL' | 'MONTHLY' | 'WEEKLY' | 'DAILY' required
returnUrlstring

Frontend return URL

callbackUrlstring

Backend callback URL for payment status updates

refNostring

Reference number (cart ID) - auto-generated if not provided

memberIDstring

Member ID

walletIDstring

Wallet ID

documentIDstring

Document ID

remarkstring

Remark

v_billemailstring

Billing email (v_billemail) - Email address for billing. If not provided, userEmail will be used.

v_billphonestring

Billing phone (v_billphone) - Phone number for billing. If not provided, userContact will be used.

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.

successboolean required

Success indicator

messagestring required

Message

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.