curl --request POST \
--url https://uat-interface.haipay.asia/sar/collect/apply \
--header 'Content-Type: application/json' \
--data '
{
"appId": 1054,
"orderId": "M233323000059",
"name": "Abdullah Al-Qahtani",
"phone": "0512345678",
"email": "abdullah.qahtani@gmail.com",
"amount": "500.00",
"currency": "SAR",
"payType": "ONLINE_BANKING",
"inBankCode": "MADA",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"goodsName": "Premium Widget",
"goodsQuantity": "1",
"goodsPrice": "100.00",
"goodsSku": "SKU-001",
"goodsAvatar": "https://merchant.com/images/product.png",
"platform": "WEB",
"subject": "Payment for order",
"body": "Premium subscription",
"partnerUserId": "149597870",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
'import requests
url = "https://uat-interface.haipay.asia/sar/collect/apply"
payload = {
"appId": 1054,
"orderId": "M233323000059",
"name": "Abdullah Al-Qahtani",
"phone": "0512345678",
"email": "abdullah.qahtani@gmail.com",
"amount": "500.00",
"currency": "SAR",
"payType": "ONLINE_BANKING",
"inBankCode": "MADA",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"goodsName": "Premium Widget",
"goodsQuantity": "1",
"goodsPrice": "100.00",
"goodsSku": "SKU-001",
"goodsAvatar": "https://merchant.com/images/product.png",
"platform": "WEB",
"subject": "Payment for order",
"body": "Premium subscription",
"partnerUserId": "149597870",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const url = 'https://uat-interface.haipay.asia/sar/collect/apply';
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appId: 1054,
orderId: 'M233323000059',
name: 'Abdullah Al-Qahtani',
phone: '0512345678',
email: 'abdullah.qahtani@gmail.com',
amount: '500.00',
currency: 'SAR',
payType: 'ONLINE_BANKING',
inBankCode: 'MADA',
callBackUrl: 'https://merchant.com/payment/success',
callBackFailUrl: 'https://merchant.com/payment/fail',
cancelUrl: 'https://merchant.com/payment/cancel',
notifyUrl: 'https://merchant.com/api/notify',
goodsName: 'Premium Widget',
goodsQuantity: '1',
goodsPrice: '100.00',
goodsSku: 'SKU-001',
goodsAvatar: 'https://merchant.com/images/product.png',
platform: 'WEB',
subject: 'Payment for order',
body: JSON.stringify('Premium subscription'),
partnerUserId: '149597870',
sign: 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://uat-interface.haipay.asia/sar/collect/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'appId' => 1054,
'orderId' => 'M233323000059',
'name' => 'Abdullah Al-Qahtani',
'phone' => '0512345678',
'email' => 'abdullah.qahtani@gmail.com',
'amount' => '500.00',
'currency' => 'SAR',
'payType' => 'ONLINE_BANKING',
'inBankCode' => 'MADA',
'callBackUrl' => 'https://merchant.com/payment/success',
'callBackFailUrl' => 'https://merchant.com/payment/fail',
'cancelUrl' => 'https://merchant.com/payment/cancel',
'notifyUrl' => 'https://merchant.com/api/notify',
'goodsName' => 'Premium Widget',
'goodsQuantity' => '1',
'goodsPrice' => '100.00',
'goodsSku' => 'SKU-001',
'goodsAvatar' => 'https://merchant.com/images/product.png',
'platform' => 'WEB',
'subject' => 'Payment for order',
'body' => 'Premium subscription',
'partnerUserId' => '149597870',
'sign' => 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://uat-interface.haipay.asia/sar/collect/apply")
.header("Content-Type", "application/json")
.body("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"Abdullah Al-Qahtani\",\n \"phone\": \"0512345678\",\n \"email\": \"abdullah.qahtani@gmail.com\",\n \"amount\": \"500.00\",\n \"currency\": \"SAR\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"MADA\",\n \"callBackUrl\": \"https://merchant.com/payment/success\",\n \"callBackFailUrl\": \"https://merchant.com/payment/fail\",\n \"cancelUrl\": \"https://merchant.com/payment/cancel\",\n \"notifyUrl\": \"https://merchant.com/api/notify\",\n \"goodsName\": \"Premium Widget\",\n \"goodsQuantity\": \"1\",\n \"goodsPrice\": \"100.00\",\n \"goodsSku\": \"SKU-001\",\n \"goodsAvatar\": \"https://merchant.com/images/product.png\",\n \"platform\": \"WEB\",\n \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
.asString();Collection Application
Use the appId corresponding to SAR. After successful user payment, the SAR balance will be increased.
curl --request POST \
--url https://uat-interface.haipay.asia/sar/collect/apply \
--header 'Content-Type: application/json' \
--data '
{
"appId": 1054,
"orderId": "M233323000059",
"name": "Abdullah Al-Qahtani",
"phone": "0512345678",
"email": "abdullah.qahtani@gmail.com",
"amount": "500.00",
"currency": "SAR",
"payType": "ONLINE_BANKING",
"inBankCode": "MADA",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"goodsName": "Premium Widget",
"goodsQuantity": "1",
"goodsPrice": "100.00",
"goodsSku": "SKU-001",
"goodsAvatar": "https://merchant.com/images/product.png",
"platform": "WEB",
"subject": "Payment for order",
"body": "Premium subscription",
"partnerUserId": "149597870",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
'import requests
url = "https://uat-interface.haipay.asia/sar/collect/apply"
payload = {
"appId": 1054,
"orderId": "M233323000059",
"name": "Abdullah Al-Qahtani",
"phone": "0512345678",
"email": "abdullah.qahtani@gmail.com",
"amount": "500.00",
"currency": "SAR",
"payType": "ONLINE_BANKING",
"inBankCode": "MADA",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"goodsName": "Premium Widget",
"goodsQuantity": "1",
"goodsPrice": "100.00",
"goodsSku": "SKU-001",
"goodsAvatar": "https://merchant.com/images/product.png",
"platform": "WEB",
"subject": "Payment for order",
"body": "Premium subscription",
"partnerUserId": "149597870",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const url = 'https://uat-interface.haipay.asia/sar/collect/apply';
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appId: 1054,
orderId: 'M233323000059',
name: 'Abdullah Al-Qahtani',
phone: '0512345678',
email: 'abdullah.qahtani@gmail.com',
amount: '500.00',
currency: 'SAR',
payType: 'ONLINE_BANKING',
inBankCode: 'MADA',
callBackUrl: 'https://merchant.com/payment/success',
callBackFailUrl: 'https://merchant.com/payment/fail',
cancelUrl: 'https://merchant.com/payment/cancel',
notifyUrl: 'https://merchant.com/api/notify',
goodsName: 'Premium Widget',
goodsQuantity: '1',
goodsPrice: '100.00',
goodsSku: 'SKU-001',
goodsAvatar: 'https://merchant.com/images/product.png',
platform: 'WEB',
subject: 'Payment for order',
body: JSON.stringify('Premium subscription'),
partnerUserId: '149597870',
sign: 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://uat-interface.haipay.asia/sar/collect/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'appId' => 1054,
'orderId' => 'M233323000059',
'name' => 'Abdullah Al-Qahtani',
'phone' => '0512345678',
'email' => 'abdullah.qahtani@gmail.com',
'amount' => '500.00',
'currency' => 'SAR',
'payType' => 'ONLINE_BANKING',
'inBankCode' => 'MADA',
'callBackUrl' => 'https://merchant.com/payment/success',
'callBackFailUrl' => 'https://merchant.com/payment/fail',
'cancelUrl' => 'https://merchant.com/payment/cancel',
'notifyUrl' => 'https://merchant.com/api/notify',
'goodsName' => 'Premium Widget',
'goodsQuantity' => '1',
'goodsPrice' => '100.00',
'goodsSku' => 'SKU-001',
'goodsAvatar' => 'https://merchant.com/images/product.png',
'platform' => 'WEB',
'subject' => 'Payment for order',
'body' => 'Premium subscription',
'partnerUserId' => '149597870',
'sign' => 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://uat-interface.haipay.asia/sar/collect/apply")
.header("Content-Type", "application/json")
.body("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"Abdullah Al-Qahtani\",\n \"phone\": \"0512345678\",\n \"email\": \"abdullah.qahtani@gmail.com\",\n \"amount\": \"500.00\",\n \"currency\": \"SAR\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"MADA\",\n \"callBackUrl\": \"https://merchant.com/payment/success\",\n \"callBackFailUrl\": \"https://merchant.com/payment/fail\",\n \"cancelUrl\": \"https://merchant.com/payment/cancel\",\n \"notifyUrl\": \"https://merchant.com/api/notify\",\n \"goodsName\": \"Premium Widget\",\n \"goodsQuantity\": \"1\",\n \"goodsPrice\": \"100.00\",\n \"goodsSku\": \"SKU-001\",\n \"goodsAvatar\": \"https://merchant.com/images/product.png\",\n \"platform\": \"WEB\",\n \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
.asString();Secret Key & Private Key (Generate Signature)
Related Topics
Body
Business ID (obtained from backend, must match the currency in the URL)
Merchant Order Number
48Recipient name, used for risk control
Real mobile number
Real email address
Transaction amount (unit: local currency, accurate to two decimal places; punctuation marks such as "," are prohibited), test environment please use amount below 10SAR
^\d+\.\d{2}$Transaction type
Redirect URL after successful payment
Redirect URL after failed payment
Product name
Product quantity
Product price
^\d+\.\d{2}$Product unique identifier
Product image (https://)
Platform name
Unique user identifier (e.g., userId), used for risk control system, must be valid, otherwise it will affect the transaction. Format: digits, letters, or symbols -~!@#$%&*()_.
^[A-Za-z0-9\-~!@#$%&*()_]+$Signature
Currency (USD, local currency)
Cancel payment redirect URL. If provided, users can click back on the payment page and be redirected to this URL
Callback URL
Payment note
Additional description

