Quickpay Cancel API
HejKan nogen se hvad der er galt her, siden det ikke virker:
<?php
$protocol = '3';
$msgtype = 'cancel';
$merchant = '27511171';
$transaction = '35790454';
$secret = 'minkodeher';
$md5checked = md5($protocol . $msgtype . $merchant . $transaction . $secret);
$url = "https://secure.quickpay.net/ (...)
$postdata = "protocol=3&msgtype=cancel&merchant=27511171&transaction=35790454&md5check=$md5checked";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0');
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 = new SimpleXMLElement($result);
echo $xml->qpstatmsg;
?>
Prøver at sende til Quickpay gennem deres API. Har fundet noget af koden her i forummet.
Disse oplysninger er givet fra Quickpay:
The QuickPay API is an open protocol that enables merchants to handle payments in a simple manner. The protocol is based on SSL encrypted HTTP communication and all actions are perfomed by sending a HTTP POST request to https://secure.quickpay.dk/ (...) (See Example 1). Upon each request sent, QuickPay will respond with a simple XML document (See Example 2). Please notice: do not send API requests to https://secure.quickpay.dk/ (...) /form/ is only for authorizes using the Quickpay Payment Window.
Example 1. HTTP POST request for cancel
POST /api HTTP/1.1
Host: secure.quickpay.dk
User-Agent: Mozilla/4.0
Content-Length: 107
Content-Type: application/x-www-form-urlencoded
protocol=3
&msgtype=cancel
&merchant=11111111
&transaction=22222222
&md5check=9625ae14fab6adf160cdd3be434dc071
---------------
Example 2. XML response for cancel
<?xml version="1.0" encoding="UTF-8"?>
<response>
<msgtype>cancel</msgtype>
<ordernumber>RTEST-119756038112</ordernumber>
<amount>234</amount>
<currency>DKK</currency>
<time>071213163941</time>
<state>5</state>
<chstat>000</chstat>
<qpstat>000</qpstat>
<qpstatmsg>OK</qpstatmsg>
<merchantemail>test@quickpay.dk</merchantemail>
<merchant>QuickPay test account</merchant>
<transaction>5366754</transaction>
<cardtype>Dankort</cardtype>
<md5check>a429f70032e131bed9364a3578953f47</md5check>
</response>
