Fiuu Payment Gateway API

Secure payment integration for your applications

Overview

This payment gateway allows your application to process payments through Fiuu (formerly MOLPay/RazerPay). Authentication is handled via JWT tokens.

Payment Flow

1. Get Token 2. Create Payment 3. Redirect to Payment URL 4. Receive Callback

Authentication

POST /api/auth/token

Generate a JWT access token using your API credentials.

Request Body

{
    "client_id": "your_client_id",
    "client_secret": "your_client_secret"
}

Response

{
    "success": true,
    "data": {
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "token_type": "bearer",
        "expires_in": 3600,
        "client_name": "Your App Name"
    }
}

Using the Token

Include the token in the Authorization header for all protected endpoints:

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

Create Payment

POST /api/payments

Create a new payment transaction and get the payment URL.

Request Headers

Authorization: Bearer {your_token}
Content-Type: application/json

Request Body

ParameterTypeDescription
order_idstring requiredYour unique order identifier
amountnumber requiredPayment amount (min: 0.01)
currencystring optionalCurrency code (default: MYR)
customer_namestring optionalCustomer's name
customer_emailstring optionalCustomer's email
customer_phonestring optionalCustomer's phone number
descriptionstring optionalPayment description
metadataobject optionalAdditional custom data

Example Request

{
    "order_id": "ORD-12345",
    "amount": 100.00,
    "currency": "MYR",
    "customer_name": "John Doe",
    "customer_email": "john@example.com",
    "customer_phone": "0123456789",
    "description": "Payment for Order #12345",
    "metadata": {
        "product_id": "PROD-001",
        "notes": "Express delivery"
    }
}

Response

{
    "success": true,
    "transaction_id": "TXN1234567890ABCDEFGH",
    "payment_url": "https://sandbox.merchant.razer.com/RMS/pay/...",
    "expires_at": "2024-01-15T12:30:00+08:00"
}

Important: Redirect the customer to the payment_url to complete the payment.

Check Payment Status

GET /api/payments/{transaction_id}

Get the current status of a payment transaction.

Response

{
    "success": true,
    "data": {
        "transaction_id": "TXN1234567890ABCDEFGH",
        "order_id": "ORD-12345",
        "amount": "100.00",
        "currency": "MYR",
        "status": "completed",
        "customer_name": "John Doe",
        "customer_email": "john@example.com",
        "payment_channel": "fpx",
        "payment_method": "Maybank2U",
        "description": "Payment for Order #12345",
        "created_at": "2024-01-15T12:00:00+08:00",
        "completed_at": "2024-01-15T12:05:00+08:00"
    }
}

Payment Statuses

StatusDescription
pendingPayment created, awaiting customer action
completedPayment successful
failedPayment failed or rejected
cancelledPayment cancelled by customer
expiredPayment session expired

List Transactions

GET /api/payments

Get a paginated list of your transactions.

Query Parameters

ParameterTypeDescription
statusstringFilter by status (pending, completed, failed)
order_idstringFilter by order ID
from_datedateFilter from date (YYYY-MM-DD)
to_datedateFilter to date (YYYY-MM-DD)
per_pageintegerResults per page (default: 15)

Webhooks

Configure your webhook URL in your API client settings to receive real-time payment notifications.

Webhook Payload

{
    "event": "payment.completed",
    "transaction_id": "TXN1234567890ABCDEFGH",
    "order_id": "ORD-12345",
    "amount": "100.00",
    "currency": "MYR",
    "status": "completed",
    "payment_channel": "fpx",
    "completed_at": "2024-01-15T12:05:00+08:00",
    "metadata": {
        "product_id": "PROD-001"
    }
}

Note: Your webhook endpoint should return HTTP 200 to acknowledge receipt. Failed webhooks will be retried up to 5 times.

Error Responses

{
    "success": false,
    "message": "Error description",
    "errors": {
        "field_name": ["Validation error message"]
    }
}

HTTP Status Codes

CodeDescription
200Success
201Created
401Unauthorized - Invalid or expired token
403Forbidden - Client inactive or IP not allowed
404Not Found
409Conflict - Duplicate order ID
422Validation Error
500Server Error