WeChat Pay

ตัวอย่างขั้นตอนการชำระเงินผ่านระบบ ChillPay : WeChat Pay

ตัวอย่าง การเรียก Request Payment Service (Code ภาษา PHP)

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://sandbox-appsrv2.chillpay.co/api/v2/Payment/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "MerchantCode=XXXX&OrderNo=00001&CustomerId=100001&Amount=25000&PhoneNumber=0890000000&Description=Test-Payment&ChannelCode=epayment_wechatpay&Currency=764&LangCode=TH&RouteNo=1&IPAddress=127.0.0.1&ApiKey=XXXX&CustEmail=test@test.com&CheckSum=XXXX",
  CURLOPT_HTTPHEADER => array(
    "Cache-Control: no-cache",
    "Content-Type: application/x-www-form-urlencoded"
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

ตัวอย่าง การเรียก Request Payment Service (Code ภาษา C# .NET)

var client = new RestClient("https://sandbox-appsrv2.chillpay.co/api/v2/Payment/");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("form-data", "MerchantCode=XXXX&ChannelCode=epayment_wechatpay&RouteNo=1&OrderNo=00001&Amount=5000&CustomerId=C000001&Description=test-payment&PhoneNumber=0880999999&LangCode=TH&ApiKey=XXXX&CustEmail=test@test.com&CheckSum=XXXX", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Updated on February 23, 2024

Related Articles