Answer the question
In order to leave comments, you need to log in
API privat24, mobile top-ups. Where did I go wrong?
https://api.privatbank.ua/api-privat24/directfill.html
here is what I wrote:
<?php
$data = '
<oper>cmt</oper>
<wait>0</wait>
<test>1</test>
<payment id="">
<prop name="service_code" value="RPMTSU" />
<prop name="phone" value="%2B38066ххххххх" />
<prop name="amt" value="5.00" />
</payment>
';
$password="большая тайна";
$sign=sha1(md5($data.$password));
$xml='<?xml version="1.0" encoding="UTF-8"?>
<request version="1.0">
<merchant>
<id>111111</id>
<signature>'.$sign.'</signature>
</merchant>
<data>'
.$data.
'</data>
</request>';
$ch = curl_init("https://api.privatbank.ua/p24api/directfill");
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
$result=curl_exec ($ch);
print($xml);
print_r($result);
$info=curl_getinfo($ch);
curl_close($ch);
?>
Answer the question
In order to leave comments, you need to log in
everything is very simple, the error was that the $data variable needs to be written in this form (enter everything in one line):
$data = '<oper>cmt</oper><wait>0</wait><test>1</test><payment id=""><prop name="service_code" value="RPMTSU" /><prop name="phone" value="%2B38066ххххххх" /><prop name="amt" value="5.00" /></payment>';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question