post
https://uat.herepay.org/api/v1/herepay/initiate
Starts a payment and takes the customer to their bank to pay.
When to use: when the customer clicks Pay after picking a bank.
What to send
| Field | Required? | What it is |
|---|---|---|
name | Yes | Customer's name |
email | Yes | Customer's email. The receipt goes here. |
phone | Yes | Customer's phone number |
amount | Yes | Amount in RM, e.g. 10.00 |
description | Yes | What the customer is paying for |
payment_code | Yes | Your own order number. Use a new one for every order. |
payment_method | Yes | Online Banking or Corporate Banking (from Get Payment Channels) |
bank_prefix | Yes | Code of the bank the customer picked (from Get Payment Channels) |
callback_url | Optional | Where Herepay sends the payment result for this order |
redirect_url | Optional | Where the customer goes after paying. Must start with https:// |
checksum | Yes | Security code (see the collection overview) |
About callback_url and redirect_url
callback_url and redirect_urlBoth are optional. If you leave them out, Herepay uses the addresses saved in your Herepay Settings. If Settings is also empty, the customer sees the Herepay receipt page.
If you send them, include them in the checksum too.
What happens next
You get back a web page, not data. Show this page to the customer and it takes them straight to their bank.
Send this request from your server, never from the customer's browser, so your keys stay safe.
If something is wrong
| Result | Meaning |
|---|---|
401 | Wrong keys, or the checksum doesn't match |
422 | A field is missing or wrong. The reply tells you which one. |
400 | The payment couldn't be created |
For developers
// Laravel
$fields = [
'name' => 'Ali bin Abu',
'email' => '[email protected]',
'phone' => '0123456789',
'amount' => '10.00',
'description' => 'Order #1001',
'payment_code' => 'ORDER-1001',
'payment_method' => 'Online Banking',
'bank_prefix' => 'ABB0233',
];
ksort($fields);
$fields['checksum'] = hash_hmac('sha256', implode(',', $fields), $privateKey);
$response = Http::asForm()
->withHeaders(['SecretKey' => $secretKey, 'XApiKey' => $apiKey])
->post('https://app.herepay.org/api/v1/herepay/initiate', $fields);
return response($response->body()); // shows the page that goes to the bank
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…

