我需要帮助将POLi支付与自定义PHP集成(无cms) 这是指向官方 pdf file的链接 可能是我需要这部分代码与php集成(来自这个pdf file)
- > GenerateURL请求
为了生成支付URL,商家对POLi TM执行HTTP(S)发布
PaymentAPI REST URL与请求内容 - 类型设置为'text / xml'和以下
请求正文中的XML数据。
手动请求(RequestType ='Manual')
<?xml version="1.0" encoding="utf-‐8"?>
<PaymentDataRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-‐instance">
<MerchantCode>PriceBusterDVD</MerchantCode>
<AuthenticationCode>MerchantPassword</AuthenticationCode>
<RequestType>Manual</RequestType>
<PaymentAmount>123.11</PaymentAmount>
<PaymentReference>LandingPageReferenceText</PaymentReference>
<ConfirmationEmail>No</ConfirmationEmail>
<CustomerReference>No</CustomerReference>
<RecipientName></RecipientName>
<RecipientEmail></RecipientEmail>
</PaymentDataRequest>
答案 0 :(得分:0)
要在没有任何框架的情况下执行此操作,将需要使用CURL并使用post字段发送XML。
$payload = '<?xml version="1.0" encoding="utf-‐8"?>
<PaymentDataRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-‐instance">
<MerchantCode>PriceBusterDVD</MerchantCode>
<AuthenticationCode>MerchantPassword</AuthenticationCode>
<RequestType>Manual</RequestType>
<PaymentAmount>123.11</PaymentAmount>
<PaymentReference>LandingPageReferenceText</PaymentReference>
<ConfirmationEmail>No</ConfirmationEmail>
<CustomerReference>No</CustomerReference>
<RecipientName></RecipientName>
<RecipientEmail></RecipientEmail>
</PaymentDataRequest>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://polipaymenturl.com');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
有关使用cURL的详细信息,请参阅PHP cURL book。
(注意我给出的示例未经过测试,但缺少正确的URL,但这应该会让您走上正确的路径)