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</ConfirmationEmail>
<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)
Related
I'm working on Bus API of arzoo. The server must receive the posted data in simple POST Request. To achieve this i'm using PHP cURL. In the API Document it is clearly mention that the data should be sent in the following format:
<BusRequest>
<source>HYDERABAD</source>
<dest>BANGALORE</dest>
<dep_date>25-Mar-2016</dep_date>
<PartnerId>ID of the partner given by arzoo</PartnerId>
<Clientid>ID of the client given by arzoo</Clientid>
<Clientpassword>Client password given by arzoo</Clientpassword>
<Clienttype>ArzooBUSWS1.0</Clienttype>
</BusRequest>
My PHP cURL code is as follows:
$input_xml = '<BusRequest>
<source>Ernakulam</source>
<dest>Kozhikode</dest>
<dep_date>15-Nov-2017</dep_date>
<PartnerId>partner</PartnerId>
<Clientid>clientid</Clientid>
<Clientpassword>password</Clientpassword>
<Clienttype>clienttype</Clienttype>
</BusRequest>';
$url = "url";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"xmlRequest=" . $input_xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
$data = curl_exec($ch);
curl_close($ch);
I'm not getting any valid xml as response.Am i doing anything wrong ?. Your reply will be appreciated. Thank You.
I have been trying to figure out how to make a soap request using php/laravel. But from all the research on internet since two days now the only things that I can find are old rusty php codes to make soap requests non of them even worked:
Here is a snipped that I am trying to make it work so I have a general view of those soap requests but I only get errors not able to make a soapclient:
<?php
$aHTTP['http']['header'] = "User-Agent: PHP-SOAP/5.5.11\r\n";
$aHTTP['http']['header'].= "username: XXXXXXXXXXX\r\n"."password: XXXXX\r\n";
$context = stream_context_create($aHTTP);
$client=new SoapClient("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl",array('trace' => 1,"stream_context" => $context));
$result = $client::__getFunctions();
var_dump($result);
since it looks super hard to me to find any info about the soap with php any idea ?
This is a sample of a soap request I currently make to a payment provider via php using curl statements. Basically map the xml request you want to make in a string. The string will be sent in the curl post fields and the response returned.
$soapdata="<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:tns='tns:ns'>
<soapenv:Header>
<tns:CheckOutHeader>
<MERCHANT_ID>$merchantid</MERCHANT_ID>
<PASSWORD>$password</PASSWORD>
<TIMESTAMP>$timestamp</TIMESTAMP>
</tns:CheckOutHeader>
</soapenv:Header>
<soapenv:Body>
<tns:processCheckOutRequest>
<MERCHANT_TRANSACTION_ID>$merchanttransactionid</MERCHANT_TRANSACTION_ID>
<REFERENCE_ID>$referenceid</REFERENCE_ID>
<AMOUNT>$amount</AMOUNT>
<MSISDN>$mobileno</MSISDN>
<!--Optional:-->
<ENC_PARAMS></ENC_PARAMS>
<CALL_BACK_URL>$callbackurl</CALL_BACK_URL>
<CALL_BACK_METHOD>$callbackmethod</CALL_BACK_METHOD>
<TIMESTAMP>$timestamp</TIMESTAMP>
</tns:processCheckOutRequest>
</soapenv:Body>
</soapenv:Envelope>";
//End Soap data
//We call the server for the first time
//end calling function
function makesoaprequest($url, $soapdata)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'Authorization: Basic'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$soapdata");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Begin SSL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
//End SSL
$response = curl_exec($ch);
return $response;
curl_close($ch);
}
I want to integrate flight API of "yatra". I have xml that we need to to get the result. I have written the following code inside api folder in index.php file, but it keeps reloading the page
hi i am trying to integrate the travel API. i am using following POS code:-
$xml='<POS xmlns="http://www.opentravel.org/OTA/2003/05">
<Source AgentSine="" PseudoCityCode="NPCK" TerminalID="1"><RequestorID ID="AFFILIATE"/>
</Source>
<YatraRequests>
<YatraRequest DoNotHitCache="true" DoNotCache="false" RequestType="SR" AffiliateID="TRAVELPARTNER" MidOfficeAgentID="7499" YatraRequestTypeCode=”SMPA”/>
</YatraRequests>
</POS>';
`$url = "http://localhost/api/index.php";
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,"xmlRequest=" . $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 900);
$data = curl_exec($ch);
curl_close($ch);
print_r($data); die;
//convert the XML result into array
$array_data = json_decode(json_encode(simplexml_load_string($data)), true);
please let me know if I am missing something. above is POS node.The POS element node is common for all the requests send to Yatra Application Framework.
When I tried to retreive all categories through the eBay Trading API with the method getCategories, I got this error:
FailureApplication name invalid.API application "222277"
invalid.127Error222277RequestError895E895_INTL_APICATALOG_17257399_R1
The header used is:
$headers = array(
'Content-Type:text/xml',
'X-EBAY-API-COMPATIBILITY-LEVEL: 895',
'X-EBAY-API-DEV-NAME: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'X-EBAY-API-APP-NAME: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
'X-EBAY-API-CERT-NAME: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'X-EBAY-API-CALL-NAME: GetCategories',
'X-EBAY-API-SITEID: 0'
);
The XML postfields:
$body = <<<BODY
<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>auth token......</eBayAuthToken>
</RequesterCredentials>
<CategorySiteID>0</CategorySiteID>
<DetailLevel>ReturnAll</DetailLevel>
</GetCategoriesRequest>
BODY;
and curl code:
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, $endpoint);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $body);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($connection);
curl_close($connection);
Ebay provides an API test tool.
It will pre-populate your credentials and let you make a test call.
Test Tool
This will help you debug any errors that you might get.
Unfortunately, eBay recently discontinued their API test tool. However, there are some 3rd party ones that may suffice.
For your issue, I recommend using the simpler Shopping API call called GetCategoryInfo. You don't need to POST your request or send any HTTP headers, and you can build your entire call into 1 URL/REST/GET request. This makes debugging much easier.
Either way you go about it, I don't think you can retrieve all of eBay's categories with 1 request. Instead, plan to loop through the category tree at each level, collecting the child category names and IDs.
I am trying to call service via curl and here is my code and every time I got the attached error
error_reporting(-1);
$qbsite = "https://qbo.sbfinance.intuit.com/resource/account/v2/960432556";
$headers = array(
'Content-Type'=>'application/xml',
'oauth_version' => "1.0",
'oauth_signature_method'=>"HMAC-SHA1",
'oauth_nonce'=>"xxx",
'oauth_timestamp'=>"xxx",
'oauth_consumer_key'=>"qyprdvZraQrBVbrPIptwd6gl6C6knP",
'oauth_token'=>"qyprdyLcCq9KMGVzqxtObeOkTvSWhhi7sNSW62u9gwqDXsc7",
'oauth_signature'=>"LnVYSgE9YZ77KgKZ1kLT3ouIu1M=",
);
$xmlData = '<?xml version="1.0" encoding="utf-16"?>
<Account xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2">
<Name>Loan Account </Name>
<Desc>Loan Account</Desc>
<Subtype>Savings</Subtype>
<AcctNum>5001</AcctNum>
<OpeningBalanceDate>2010-05-14</OpeningBalanceDate>
</Account>';
$ch = curl_init($qbsite);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "\n{$xmlData}");
$response = curl_exec($ch);
print($response);die; !
This:
$headers = array(
'Content-Type'=>'application/xml',
'oauth_version' => "1.0",
'oauth_signature_method'=>"HMAC-SHA1",
'oauth_nonce'=>"xxx",
'oauth_timestamp'=>"xxx",
'oauth_consumer_key'=>"qyprdvZraQrBVbrPIptwd6gl6C6knP",
'oauth_token'=>"qyprdyLcCq9KMGVzqxtObeOkTvSWhhi7sNSW62u9gwqDXsc7",
'oauth_signature'=>"LnVYSgE9YZ77KgKZ1kLT3ouIu1M=",
);
Is not even close to a correct OAuth signature. OAuth signatures place all of that information in a single Authorization: ... HTTP header, whereas you've slapped each piece of OAuth data in a separate HTTP header.
For example, a correct OAuth header looks something like this:
Authorization: OAuth realm="",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_nonce="kllo9940pd9333jh",
oauth_timestamp="1191242096",
oauth_signature_method="HMAC-SHA1",
oauth_version="1.0",
oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D"
Additionally, OAuth signatures are not static values - they must be calculated and they change with EVERY request.
You should download the nightly build of the QuickBooks PHP DevKit (disclaimer: I'm the author) - it's a library that is specifically designed to do exactly what you're doing (integrate with QuickBooks), and it takes care of building the correct OAuth requests for you.
Specifically, download it and look at these examples:
docs/example_ipp_oauth.php
docs/example_ipp_ids_5.php
Have you tried removing the , at the end of this line
'oauth_signature'=>"LnVYSgE9YZ77KgKZ1kLT3ouIu1M=",