Skip to content

Instantly share code, notes, and snippets.

@tkjaergaard
Created May 10, 2012 10:00
Show Gist options
  • Select an option

  • Save tkjaergaard/2652247 to your computer and use it in GitHub Desktop.

Select an option

Save tkjaergaard/2652247 to your computer and use it in GitHub Desktop.
QP
<?php
require_once('xml.php');
$url = "https://secure.quickpay.dk/api";
$protocol = 4;
$msgtype = 'recurring';
$merchant = '89898978';
$ordernumber = 1334227428;
$amount = 500;
$currency = 'DKK';
$autocapture = 1;
$transaction = 42131585;
$apikey = 'MIl16LPa152HZB6wA4dNXv31UF8n1f7e8W327mrz684cg399C2j49t7Yb8Qxy79i';
$secret = '29p61DveBZ79c3144LW61lVz1qrwk2gfAFCxPyi5sn49m3Y3IRK5M6SN5d8a68u7';
$md5check = md5($protocol.$msgtype.$merchant.$ordernumber.$amount.$currency.$autocapture.$transaction.$apikey.$secret);
$postdata = "protocol=$protocol&msgtype=$msgtype&merchant=$merchant&ordernumer=$ordernumber&amount=$amount&currency=$currency&autocapture=$autocapture&transaction=$transaction&apikey=$apikey&secret=$secret&md5check=$md5check";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$result = curl_exec($ch);
$xml = xmlstr_to_array($result);
echo '<pre>';
print_r($xml);
echo '</pre>';
echo '<pre>';
print_r($xml['state']);
echo '</pre>';
echo '<pre>';
print_r($md5check);
echo '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment