$ request=new lipaytradeapppayrequest;
//SDK已經封裝掉了公共參數,這里只需要傳入業務參數
$bizcontent=json_encode(數組(
out _ trade _ no '=$ order[' order _ sn '],
total _ amount '=$ order[' order _ price '],
timeout_express'='30m ',
product _ code '=' QUICK _ MSECURITY _ PAY ',
主題"="訂單測試'
));
//$ biz content=' { \ ' body ' : \ '我是測試數據\','
//.\ '主題' : '應用程序支付測試\','
//.\ ' out _ trade _ no ' : ' 20210125 test 01 \ ','
//.\ ' timeout _ express \ ' : \ ' 30m \ ','
//.\ ' total _ amount \ ' : \ ' 0.01 \ ','
//.\ '產品代碼:“QUICK _ MSecurity _ PAY \”
//.'}';
$ request-setNotifyUrl(' API。凈199。com/public/index。PHP/API/5b 75304 b 765 af’);
$ request-SetBizContent($ BizContent);
//這里和普通的接口調用不同,使用的是sdkExecute
$ response=$ AOP-SDKexecute($ request);
//specialchars是為了輸出到頁面時防止被瀏覽器將關鍵參數轉義,實際打印到日志以及傳輸不會有這個問題還原
echo specialchars(回應);//就是orderString可以直接給客戶端請求,無需再做處理。