DengiOnline

2017-07-29 03:29:14

Payment status check

Payment status check indicates whether the paid goods or services can be provided to the customer.

The protocol for getting information about a specific payment is used to retrieve payment information based on its ID either on the Project side or the System side. If both IDs are sent, the System payment ID is used, as it has higher priority.

The Project sends a request consisting of a JSON array using POST method to the System handler located at the page https://www.onlinedengi.ru/api/dol/payment/get/. Parameters sent from the Project to the System are described in the table below. 

Request parameters 

Parameter Description Format Mandatory

payment

Payment ID in the System (corresponds to paymentid)

string (256)

Yes

At least one parameter should be specified. If both parameters are sent, the payment value is used.

order

Payment ID in the Project system (corresponds to order_id)

string (256)

X-DOL-Project

Project ID in the System 

NOTE! The parameter value must be placed in the request header and not in the body.

integer

Yes

X-DOL-Sign

Request signature.

Created from the complete body of the request using the HMAC-SHA1 algorithm. A request is generated using the key which is a project secret word, agreed by the parties and used to generate the hash code when prompted to carry out a payment from the System to the Project. 

NOTE! The parameter value must be placed in the request header and not in the body.

hex

Yes

A successful request to the System results in getting HTTP Status 200. In case of failure, the Project receives another HTTP Status (other than 200) and the body of the message contains error description.  

The full list of HTTP statuses that can be returned by the System is available here.

In case of successful request the System will return a JSON response which contains the following tags:

Parameter Description Format
id Payment ID in the System string(256)
amount_rub Payment amount in Russian rubles decimal(10.2), delimiter — decimal point
status Digital payment status according to the DengiOnlne classifier (see below for the list of the statuses) integer
status_description Digital payment status description string
order Payment ID in the Project system sent by the Project on the payment initialization string (30)
nick  User ID in the Project system sent by the Project on the payment initialization string (256)
date_payment Payment time and date in the YYYY — mm-ddTHH:ii:ss+Z

string, YYYY-mm-ddTHH:ii:ss+Z

paymode  Identifier of the Payment System through which the payment was made (see Table mode_type) int(10)
currency_project Invoice currency sent by the Project upon the payment initialization.

string, ISO 4217, alfa-3

amount_project Payment amount sent by the Project upon payment initialization in the currency defined by the Project decimal(10.2), delimiter — decimal point
currency_paymode Payment mode currency in which the user made the actual payment.

string, ISO 4217, alfa-3


List of payment statuses according to the System classifier  

Payment digital status

Digital status details

Description

Final status?

0, 1, 2, 13

in processing

Registered account. User redirected to the payment system page

The status is not final. Check it again after receiving notification

3, 4, 6, 10, 11, 12, 15, 16, 17, 18, 19

attention

A problem occurred during the System — Project interaction. Please, contact the System technical support

The status is not final.
Wait for another notification on this payment to your callback and check the payment status. If the status has not changed, please, contact the support (support@dengionline.com) and provide the payment ID in the System (paymentid parameter value)

7, 8

error

Payment not accepted by the Payment System

The status is final.
Try repeating the payment

9

processed

Successful payment

The status is final.
No additional actions needed

24

processed (test)

Successful test payment. It is not considered in account balance settling

The status is final.
No additional actions needed

5, 14, 20

rejection

Rejected payment. The funds were returned to the customer

The status is final.
The payment was rejected. We do not recommend providing the service to the customer

22

card HOLD

Successful payment authorization while putting the card on hold

The status is not final

25

HOLD success

Successful payment hold

The status is not final

Response example (success)

Status Code: 200 OK
Cache-Control: private, must-revalidate Connection: keep-alive Content-Type: application/json 
Date: Mon, 11 Feb 2013 09:28:47 GMT 
Expires: -1 
Pragma: no-cache Server: nginx Transfer-Encoding: chunked X-Powered-By: PHP/5.3.3-7+squeeze14   
[ 
{ 
"id": 123456789, 
"amount_rub": "250.00", 
"status": 9, 
"status_description": "The payment is successfully processed", 
"order": "87654", 
"nick": "87654", 
"date_payment": "2013-02-06T00:08:44+04:00", 
"paymode": 2, 
"currency_project": "RUB", 
"amount_project": "250.00", 
"currency_paymode": "RUB" 
} 
]  

Response example (failure)

Status Code: 401 Unauthorized
Cache-Control: private, must-revalidate Connection: keep-alive Content-Encoding: gzip Content-Type: text/html; charset=UTF-8
Date: Mon, 11 Feb 2013 09:32:24 GMT
Expires: -1
Pragma: no-cache Server: nginx Transfer-Encoding: chunked Vary: Accept-Encoding X-Powered-By: PHP/5.3.3-7+squeeze14 Unauthorized

 
Status Code: 400 Bad Request
Cache-Control: private, must-revalidate Connection: keep-alive Content-Encoding: gzip Content-Type: text/html; charset=UTF-8
Date: Mon, 11 Feb 2013 9:33:18 AM GMT
Expires: -1
Pragma: no-cache Server: nginx Transfer-Encoding: chunked Vary: Accept-Encoding X-Powered-By: PHP/5.3.3-7+squeeze14 Bad Request

Example of a PHP request

class DolClient  { 
protected $project; 
protected $key; 
protected $url; 
public function __construct($project, $key, $url) { $this->project = $project; $this->key = $key; $this->url = $url; } 
public function request($data)  { 
if (is_string($data)) 
{ $post_data = $data; } 
else { $post_data = json_encode($data); } 
$headers = array( 
'X-DOL-Project: '. $this->project, 
'X-DOL-Sign: '. hash_hmac('sha1', $post_data, $this->key), 
); 
$sh = curl_init(); 
curl_setopt($sh, CURLOPT_URL, $this->url); 
curl_setopt($sh, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($sh, CURLOPT_TIMEOUT, 60); 
curl_setopt($sh, CURLOPT_RETURNTRANSFER, TRUE ); 
curl_setopt($sh, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($sh, CURLOPT_SSL_VERIFYHOST, FALSE); 
curl_setopt($sh, CURLOPT_POST, TRUE ); 
curl_setopt($sh, CURLOPT_POSTFIELDS, $post_data); 
curl_setopt($sh, CURLOPT_HTTPHEADER, $headers); 
$response = curl_exec($sh); 
$curl_errno = curl_errno($sh); 
$curl_error = curl_error($sh); 
$http_code = curl_getinfo($sh, CURLINFO_HTTP_CODE); 
curl_close($sh); if ($curl_errno > 0) 
{ throw new Exception($curl_error, $curl_errno); }
if ($http_code != 200) 
{ throw new Exception($response, $http_code); }
var_dump($response); 
return json_decode($response); 
} 
} 
class DolPayment  { 
protected $client; public function __construct($project, $key)  { $this->client = new DolClient($project, $key, 'https://www.onlinedengi.ru/api/dol/payment/get/');
} 
public function findByOrder($order)  { return $this->client->request(array('order' => $order)); }
public function findByPayment($dol_id)  { return $this->client->request(array('payment' => $dol_id)); } 
}