DengiOnline

2017-07-29 03:29:13

Bank cards in iFrame

When creating invoices for bank card payments in the usual mode the mode_type parameter should have the value provided by the technical specialists during the integration.

Invoicing for bank cards in the background is performed with the help of the iFrame built-in block. In this case users are not redirected to other web-sites. This mode is available only for the following mode_type parameter values: 

  • 624 (back cards) 

For such procedures one more mandatory parameter is added to the usual list.

Parameter Description Format Mandatory
mode_type Background payment mode ID 624 Yes
xml

Response method ID

1 Yes

After processing the data provided by the Project the System sends a response in UTF-8 encoded XML format. 

If the invoice is created successfully, all the returned node values are considered to be inside information and are used to create URL-address for iFrame.

The URL returned by the iframeUrl parameter is used for the invoice.

Parameters of the response

Parameter Description Format

status

Payment status code

0 -request is successful
-1 - request failed

comment

Status comment and the list of all errors

string

iframeUrl

Link for embedding into iFrame

string

payment_id

Transaction ID on the System side

int

amount_original

Requested amount in rubles

float

currency

Payment currency in the Payment System

string

ISO 4217alfa-3

After invoicing the user is redirected to the Payment System site inside the built-in block.

Response example (success)

<?xml version="1.0" encoding="UTF-8"?> 
<response> 
	<status>0</status> 
	<iframeUrl><![CDATA[https://www.onlinedengi.ru/pay/invoice.php?id=288902752&csrf=80009f613ebd3df67a842b1f370a77f6&xml=1&lang=ru]]></iframeUrl>
	<payment_id>34343433</payment_id> 
	<amount_original>100</amount_original> 
	<currency>RUB</currency> 
</response>

Response example (failure)

<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>-1</status>
	<comment><![CDATA[Payment amount is invalid]]></comment>
</response>

iFrame example for bank card invoicing with mode_type 624 (PHP)

<?php 
$vars = array( 
'project' => 189, 
'nickname' => '23497434', 
'order_id' => '123456', 
'amount' => 100, 
'mode_type' => 624, 
'xml' => 1, 
'paymentCurrency' => 'RUB'
); 
 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'https://www.onlinedengi.ru/wmpaycheck.php'); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); 
curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
$res = curl_exec($ch); 
 
$xml = simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA); 
if(intval($xml->status) == 0){ 
$url = trim($xml->iframeUrl); 
?> 
<iframe name="onmoney" src="<?php echo $url; ?>" width="530" height="925" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe> 
<?php 
} 
else{ echo $xml->comment;
} 
?>