<?
$credentials = 'QVBJXzE0ODIyNTE4MjUyNjYyMjY1MzYwMDY6U2lsdmVyZm94OTA=';
$xmlToSend = '<card-transaction xmlns="https://sandbox.bluesnap.com">
<card-transaction-type>AUTH_CAPTURE</card-transaction-type>
<merchant-transaction-id>3</merchant-transaction-id>
<recurring-transaction>ECOMMERCE</recurring-transaction>
<soft-descriptor>DescTest</soft-descriptor>
<amount>11.00</amount>
<currency>GBP</currency>
<card-holder-info>
<first-name>Test first</first-name>
<last-name>test last</last-name>
</card-holder-info>
<credit-card>
<card-number>4263982640269299</card-number>
<security-code>837</security-code>
<expiration-month>02</expiration-month>
<expiration-year>2018</expiration-year>
</credit-card>
</card-transaction>';
$url = 'https://sandbox.bluesnap.com/services/2/transactions';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/xml"));
curl_setopt($ch, CURLOPT_USERPWD, "$credentials");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlToSend);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
/**
* Execute Curl call and display XML response
*/
$response = curl_exec($ch);
curl_close($ch);
echo show_xml($response);
?>
My php implementation for Bluesnap XML API
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.