<?php require_once("config/config.php"); $client = new Client(); $headers = [ 'Accept' => 'application/json', 'apiKey' => $apikey, 'Content-Type' => 'application/json; charset=utf-8' ]; $body = '{ "paymentType": "CC", "paymentCategory": "ECOM", "orderNo": "TT1650866348558", "productDescription": "Merchant Test Tool 1650866348389", "mcpFlag": "N", "transactionAmount": { "currencyCode": "THB", "amount": "1", "decimalPlaces": 2, "amountText": "000000000100" }, "channelCode": "WEBPAY", "request3dsFlag": "N", "autoRedirectDelayTimer": 5, "notificationURLs": { "confirmationURL": "http://confirmation-url2c2p.com", "failedURL": "http://failed-url2c2p.com", "cancellationURL": "http://cancellation-url2c2p.com", "backendURL": "http://backend-url2c2p.com" }, "recurringPaymentDetails": { "rppFlag": "N" }, "generalPayerDetails": { "personType": "General", "seqNo": 1, "personName": { "title": "Mr.", "firstName": "Merchant Test Tool User" } }, "installmentPaymentDetails": { "ippFlag": "N" }, "officeId": "2206", "apiRequest": { "requestMessageID": "3fd2e3e7-f5a9-4cee-5599-f0e7fffb995c", "requestDateTime": "2022-04-25T07:54:45.696Z", "language": "en-US" } }'; $request = new Request('POST', $endpoint, $headers, $body); $res = $client->sendAsync($request)->wait(); echo $res->getBody(); ?>