curl --request POST \
--url https://uat-interface.haipay.asia/thb/collect/apply \
--header 'Content-Type: application/json' \
--data '
{
"appId": 1054,
"orderId": "M233323000059",
"name": "John Doe",
"phone": "+66812345678",
"email": "john.doe@example.com",
"amount": "100.00",
"payType": "ONLINE_BANKING",
"inBankCode": "PROMPTPAY",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"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/thb/collect/apply"
payload = {
"appId": 1054,
"orderId": "M233323000059",
"name": "John Doe",
"phone": "+66812345678",
"email": "john.doe@example.com",
"amount": "100.00",
"payType": "ONLINE_BANKING",
"inBankCode": "PROMPTPAY",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"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 options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appId: 1054,
orderId: 'M233323000059',
name: 'John Doe',
phone: '+66812345678',
email: 'john.doe@example.com',
amount: '100.00',
payType: 'ONLINE_BANKING',
inBankCode: 'PROMPTPAY',
callBackUrl: 'https://merchant.com/payment/success',
callBackFailUrl: 'https://merchant.com/payment/fail',
cancelUrl: 'https://merchant.com/payment/cancel',
notifyUrl: 'https://merchant.com/api/notify',
subject: 'Payment for order',
body: JSON.stringify('Premium subscription'),
partnerUserId: '149597870',
sign: 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
})
};
fetch('https://uat-interface.haipay.asia/thb/collect/apply', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://uat-interface.haipay.asia/thb/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' => 'John Doe',
'phone' => '+66812345678',
'email' => 'john.doe@example.com',
'amount' => '100.00',
'payType' => 'ONLINE_BANKING',
'inBankCode' => 'PROMPTPAY',
'callBackUrl' => 'https://merchant.com/payment/success',
'callBackFailUrl' => 'https://merchant.com/payment/fail',
'cancelUrl' => 'https://merchant.com/payment/cancel',
'notifyUrl' => 'https://merchant.com/api/notify',
'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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://uat-interface.haipay.asia/thb/collect/apply"
payload := strings.NewReader("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://uat-interface.haipay.asia/thb/collect/apply")
.header("Content-Type", "application/json")
.body("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://uat-interface.haipay.asia/thb/collect/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}"
response = http.request(request)
puts response.read_body{
"status": "1",
"error": "00000000",
"msg": "success",
"data": {
"orderId": "M233323000059",
"orderNo": "6023071013539074",
"payUrl": "https://pay.haipay.asia/cashier/1L9zQS2",
"bankNo": "PC0007I10000035",
"bankCode": "PIX",
"qrCode": "00020101021228760011ph.ppmi.p2m",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
}Collection Application
Use the appId corresponding to THB. After successful user payment, the THB balance will be increased.
curl --request POST \
--url https://uat-interface.haipay.asia/thb/collect/apply \
--header 'Content-Type: application/json' \
--data '
{
"appId": 1054,
"orderId": "M233323000059",
"name": "John Doe",
"phone": "+66812345678",
"email": "john.doe@example.com",
"amount": "100.00",
"payType": "ONLINE_BANKING",
"inBankCode": "PROMPTPAY",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"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/thb/collect/apply"
payload = {
"appId": 1054,
"orderId": "M233323000059",
"name": "John Doe",
"phone": "+66812345678",
"email": "john.doe@example.com",
"amount": "100.00",
"payType": "ONLINE_BANKING",
"inBankCode": "PROMPTPAY",
"callBackUrl": "https://merchant.com/payment/success",
"callBackFailUrl": "https://merchant.com/payment/fail",
"cancelUrl": "https://merchant.com/payment/cancel",
"notifyUrl": "https://merchant.com/api/notify",
"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 options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appId: 1054,
orderId: 'M233323000059',
name: 'John Doe',
phone: '+66812345678',
email: 'john.doe@example.com',
amount: '100.00',
payType: 'ONLINE_BANKING',
inBankCode: 'PROMPTPAY',
callBackUrl: 'https://merchant.com/payment/success',
callBackFailUrl: 'https://merchant.com/payment/fail',
cancelUrl: 'https://merchant.com/payment/cancel',
notifyUrl: 'https://merchant.com/api/notify',
subject: 'Payment for order',
body: JSON.stringify('Premium subscription'),
partnerUserId: '149597870',
sign: 'af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=='
})
};
fetch('https://uat-interface.haipay.asia/thb/collect/apply', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://uat-interface.haipay.asia/thb/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' => 'John Doe',
'phone' => '+66812345678',
'email' => 'john.doe@example.com',
'amount' => '100.00',
'payType' => 'ONLINE_BANKING',
'inBankCode' => 'PROMPTPAY',
'callBackUrl' => 'https://merchant.com/payment/success',
'callBackFailUrl' => 'https://merchant.com/payment/fail',
'cancelUrl' => 'https://merchant.com/payment/cancel',
'notifyUrl' => 'https://merchant.com/api/notify',
'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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://uat-interface.haipay.asia/thb/collect/apply"
payload := strings.NewReader("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://uat-interface.haipay.asia/thb/collect/apply")
.header("Content-Type", "application/json")
.body("{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://uat-interface.haipay.asia/thb/collect/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appId\": 1054,\n \"orderId\": \"M233323000059\",\n \"name\": \"John Doe\",\n \"phone\": \"+66812345678\",\n \"email\": \"john.doe@example.com\",\n \"amount\": \"100.00\",\n \"payType\": \"ONLINE_BANKING\",\n \"inBankCode\": \"PROMPTPAY\",\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 \"subject\": \"Payment for order\",\n \"body\": \"Premium subscription\",\n \"partnerUserId\": \"149597870\",\n \"sign\": \"af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw==\"\n}"
response = http.request(request)
puts response.read_body{
"status": "1",
"error": "00000000",
"msg": "success",
"data": {
"orderId": "M233323000059",
"orderNo": "6023071013539074",
"payUrl": "https://pay.haipay.asia/cashier/1L9zQS2",
"bankNo": "PC0007I10000035",
"bankCode": "PIX",
"qrCode": "00020101021228760011ph.ppmi.p2m",
"sign": "af0gAHkUOyYHu9owQp8NJ4mPEeUW4vuJcjdxqLIzrVw8AvpLSjD1DXupReSG/CyuSkFRyiIvCp5u703AuGGmfgD2gKDH3Ywau41bAbG2jnHJ8mtjiSJ5iWUzanyd4Kr7d1+rETbzUl7/BkW3t0X8UUFdqpxwG8DPUjAwUKfplWDHV7koG51Ozexd80DCsmW6eWdouAZ1uNXGLYmV3ftE3BmfNRtuv1C5bfTJWrTEIOxbF6g2uYOFZTlIgrQgd7/2PsAYwQQXNz8Q8CYl4OxqCv4pXJxaLWPbR5tqZu9og5kn32C9aHW/NlU1y39vzz+4ef81yPAqUV9oHlSMSPrMmw=="
}
}Secret Key & Private Key (Generate Signature)
Related Topics
Body
Business ID (obtained from backend, must pass the corresponding business ID according to the currency in the URL)
Merchant order number
48Payee name (format: English letters with spaces allowed, 1–30 characters, "firstName middleName lastName" (middleName is optional, special characters allowed: !-))
1 - 30^[A-Za-z\s!-]+$Real mobile number (Format: starting with 0, 10 digits total)
Real email
Transaction amount (unit: ฿, precise to two decimal places; punctuation such as “,” is prohibited)
^\d+\.\d{2}$Transaction type
Redirect URL after successful payment
Redirect URL after failed payment
Payment note (transaction title, product name, payment reason)
User unique identifier (e.g., userId). Used for risk control. Must be valid, otherwise transaction may be affected. Format: numbers, letters, or common symbols -~!@#$%&*()_.
^[A-Za-z0-9\-~!@#$%&*()_]+$Signature
Cancel payment redirect URL. If provided, users can click back on the payment page and be redirected to this URL
Callback URL
Detailed note
Was this page helpful?

