currently working integrating new e-commerce api (swish) having bit of struggle. i'm using php , curl in app perform test-connection merchant simulator. code looks follows:
$post = array( "payeepaymentreference"=> "0123456789", "callbackurl"=> "https://myssldomain.com", "payeralias"=> "4671234768", "payeealias"=> "1231181189", "amount"=> "100", "currency"=> "sek", "message"=> "kingston usb flash drive 8 gb" ); $ch = curl_init(); curl_setopt($ch,curlopt_returntransfer, false); curl_setopt($ch,curlopt_header, true); curl_setopt($ch,curlopt_url, 'https://mss.swicpc.bankgirot.se/swish-cpcapi/api/v1/paymentrequests/'); curl_setopt($ch,curlopt_ssl_verifypeer, true); curl_setopt($ch,curlopt_ssl_verifyhost, 0); curl_setopt($ch,curlopt_postfields, $post); curl_setopt($ch,curlopt_sslkey, 'sslkey.key'); curl_setopt($ch,curlopt_sslcert, 'sslcert.crt'); curl_setopt($ch, curlopt_cainfo, 'cainfo.crt'); $data = curl_exec($ch); $error = curl_error($ch); curl_close($ch); var_dump($data);
note: callback-url in post-array different. have valid, ssl-domain set there callback url.
the response when proceeding above code this:
http/1.1 415 unsupported media type server: apache-coyote/1.1 accept-ranges: bytes etag: w/"0-1448896356000" last-modified: mon, 30 nov 2015 15:12:36 gmt content-type: text/html content-length: 0 date: sun, 24 jan 2016 21:07:00 gmt
the 3 parts of ssl-certificate can found @ swish's api site if download test-tool (guide testverktyg). can please tell me i'm doing wrong?
have tried adding
curl_setopt($ch, curlopt_httpheader, array('content-type: application/json'));
Comments
Post a Comment