Initiate Payment

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

FieldRequired?What it is
nameYesCustomer's name
emailYesCustomer's email. The receipt goes here.
phoneYesCustomer's phone number
amountYesAmount in RM, e.g. 10.00
descriptionYesWhat the customer is paying for
payment_codeYesYour own order number. Use a new one for every order.
payment_methodYesOnline Banking or Corporate Banking (from Get Payment Channels)
bank_prefixYesCode of the bank the customer picked (from Get Payment Channels)
callback_urlOptionalWhere Herepay sends the payment result for this order
redirect_urlOptionalWhere the customer goes after paying. Must start with https://
checksumYesSecurity code (see the collection overview)

About callback_url and redirect_url

Both 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

ResultMeaning
401Wrong keys, or the checksum doesn't match
422A field is missing or wrong. The reply tells you which one.
400The 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
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Form Data
string

Required. Customer's name.

string

Required. Customer's email. The receipt goes here.

integer

Required. Customer's phone number.

number

Required. Amount in RM, e.g. 10.00.

string

Required. What the customer is paying for.

string

Required. Your own order number. Use a new one for every order.

string

Required. Online Banking or Corporate Banking.

string

Required. Code of the bank the customer picked.

string

Optional. Where Herepay sends the payment result for this order.

string

Optional. Where the customer goes after paying. Must start with https://.

string

Required. Security code. Made automatically in Postman.

Headers
string

Your team's Secret Key (Herepay dashboard → Settings → API).

string

Your team's API Key (Herepay dashboard → Settings → API).

string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/plain
application/json