DengiOnline

2017-07-29 03:29:17

CHECK action

Payment pre-check 

Before the pay request (PAY action) it necessary to verify:

  • the applied service is available
  • there are enough funds to make a payment;
  • recipient exists in payment provider’s system.

So the action is sent as a pre-check payment request; the result of this action is an invoice id for the pay action.

Please note: Even if the CHECK action was successful (the response with all parameters was received), it doesn't mean that the PAY action will also be successful.

The CHECK action is only used to get the parameters required for the PAY action. Moreover, if the CHECK request is not followed by PAY reasonably soon, the system treats the invoice as obsolete and assigns to it the status 993 - INVOICE_LIFETIME_EXPIRED.

Request Parameters

Apart from basic parameters, request for payment pre-check requires the following tags in “params” node:

Parameter

Description

Format

Mandatory

txn_id

Transaction ID in the project’s system

NB: Transaction ID must be unique, otherwise request will result in error 25 - DUPLICATE_TXN

string (255)

yes

 

paysystem

 Payment provider ID in the GSG system

integer / string

yes

account

Recipient ID in the payment provider’s system (for example, card number)

Several paysystems require some additional parameters of the CHECK action request. The parameters and specifications are listed in the params node of response to the commissions_action request.

integer / string

yes

 

amount

Payment amount

If the payment amount is not specified:

  • the response will contain conversion rates from the request currency to the Payment Service Provider currency;
  • in this action, it should be indicated in the PAY action request. 

If the payment amount is specified, the response will contain information about conversion.

integer / double (4)

no

 

currency

Payment currency ID

If the payment currency is not specified in this action request, the System uses main account currency as payment currency.

Attention! Payment currency cannot be changed.
If check_action and pay_action send different currencies, then error 21 - BAD_CURRENCY will be returned.

string / integer
ISO 4217 number-3

no

 

Response Parameters

The GSG System response in XML format apart from the basic parameters contains the following nodes:

Parameter

Description

Format

invoice

Invoice ID
It has to be specified in pay action request or pay_status action request

integer

income currency="ХХХ"

Payment amount and currency

(amount) integer;

(currency) integer / string
ISO 4217 number-3

amount currency="ХХХ"

Payment amount in main account’s currency

outcome currency="ХХХ"

Payment amount in payment provider’s currency

rate income="ХХХ" outcome="ХХХ" total="ХХХ"

Conversion rates:

  • income — from payment request currency into main account’s currency;
  • outcome — from main account’s currency into payment provider’s currency;
  • total — from payment request currency into payment provider’s currency

decimal (11.4)  

delimiter — dot

Example request

<?xml version="1.0" encoding="UTF-8"?>
<request>
	<action>check</action>
	<project>1234</project>
	<timestamp>1360928308</timestamp>
		<params>
			<txn_id>511e1e34d785b</txn_id>
			<paysystem>654321</paysystem>
			<account>user@server.com</account>
			<amount>12.34</amount>
		</params>
	<sign>deb5627204b9e604d4582e80424f8ee6</sign>
</request>

Example response (success)

<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>1</status>
	<reference>501582</reference>
	<timestamp>1360928308</timestamp>
	<invoice>30876</invoice>
	<income currency="643">12.34</income>
	<amount currency="643">12.34</amount>
	<outcome currency="643">12.34</outcome>
	<rate income="1" outcome="1" total="1"></rate>
</response>

Example response (fail)

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>19</status>
    <reference>198</reference>
    <timestamp>1358259068</timestamp>
</response>