开发者

integrating POLi payment with PHP

开发者 https://www.devze.com 2023-04-04 21:09 出处:网络
I need help in integrating POLi payment with custom PHP(no cms) here is a link to a official pdf file May be i need this section of code to integrate with php (from this pdf file)

I need help in integrating POLi payment with custom PHP(no cms) here is a link to a official pdf file May be i need this section of code to integrate with php (from this pdf file)

->GenerateURL Request

To generate a Payment URL, the merchant performs a HTTP(S) post to the POLi™

PaymentAPI REST URL with the request content-­‐type set to ‘text/xml’ and the following

XML data in the request body.

Manual request (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</ConfirmationEma开发者_如何学Cil>  

<CustomerReference>No</CustomerReference>  

<RecipientName></RecipientName>  

<RecipientEmail></RecipientEmail>  
</PaymentDataRequest>


To do this without any framework will require the use of CURL and sending the XML with the post fields.

$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); 

See the PHP cURL book for more information about using cURL.

(Note the example I have given isn't tested and is missing the correct URL but this should set you on the right path)

0

精彩评论

暂无评论...
验证码 换一张
取 消