Response Page
The response page allows you to display the result of the transaction to the payer once it is completed. While this page is not mandatory for the transaction flow, it enhances the payer’s experience by redirecting them back to your site. This page helps to complete the payment journey, but consider that the payer may close the checkout without visiting it.
The integration can send the payment result data via the HTTP GET method, and your platform can invoke the response page for all transaction states, including approved, rejected, in validation, and awaiting payment (for cash).
Considerations
- Some hosting providers may have settings that block sending URLs as parameter values. For example:
&merchant_url=http%3A%2F%2Fwww.myshop.com
. - Avoid relying on the response page to update your database or trigger processes, as users may not always return to it. Use the confirmation page for these operations instead.
- If you want to display transaction-related information, we recommend showing at least the following details: status, reference, value, currency, and date.
- It is recommended to include the
responseUrl
parameter in the payment form or set it in the PayU Module. The value sent in the parameter takes priority. If the integration does not find aresponseUrl
, the payment process ends at the webcheckout.
Important
If you want PayU to always display the transaction information, leave theresponseUrl
parameter blank both in the payment form and in the PayU Module. In this case, the payment experience will not show the buyer an option to return to your website.
Parameters
Below, the parameters sent to the response page.
Parameters sent to the response page
Field | Type | Size | Description | Applies to |
---|---|---|---|---|
merchantId | Numeric | 12 | Merchant’s ID number in PayU’s system, you find this number in the account creation mail. | — |
transactionState | Numeric | 2 | Indicates the transaction’s status in the system. See the transaction states in the given column. |
— |
risk | Decimal (#.00) | — | Risk associated with the transaction. Values between 0 and 1. The higher value, the greater the risk. Format ###.00 . |
— |
polResponseCode | Alphanumeric | 64 | Response code. See the response codes in the given column. |
— |
referenceCode | Alphanumeric | 255 | Reference of the sale or order. It must be unique for each transaction sent to the system. | — |
reference_pol | Alphanumeric | 255 | Reference or transaction number generated by PayU. | — |
signature | Alphanumeric | 255 | Digital signature created for each one of the transactions. | — |
polPaymentMethod | Alphanumeric | 255 | Internal identifier of the used payment methods. | — |
polPaymentMethodType | Numeric | 2 | The type of payment method used for payment. See the codes of the payment methods. |
— |
installmentsNumber | Numeric | 2 | Number of installments in which the credit card payment was deferred. | — |
TX_VALUE | Numeric | 14,2 | Total amount of the transaction. It can contain two decimal digits. For example 10000.00 or 10000 | — |
TX_TAX | Numeric | 14,2 | Value of the VAT of the transaction, if no VAT is sent, the system applies 19% automatically. It can contain two decimal digits, for example 19000.00. In case you have no VAT you should fill out 0. |
— |
buyerEmail | Alphanumeric | 255 | Field that contains the buyer’s e-mail to notify the result of the transaction. It is recommended to validate it when the data is taken on a form. | — |
processingDate | Date (YYYY-MM-DD HH:mm:ss) | — | The date the transaction was made. | — |
currency | Alphanumeric | 3 | The respective currency in which the payment is made. The reconciliation process is performed in Colombian pesos at the representative rate of the day. | — |
cus | Alphanumeric | 255 | The CUS, unique tracking code, is the payment’s reference within the Bank, it applies only to payments with PSE. | PSE Colombia. |
pseBank | Alphanumeric | 255 | The name of the bank, applies only to payments with PSE. | PSE Colombia. |
lng | Alphanumeric | 2 | Language in which to display the payment gateway. | — |
description | Alphanumeric | 255 | Description of sale. | — |
lapResponseCode | Alphanumeric | 64 | Response code that PayU delivers. See the responses codes in the given column. |
— |
lapPaymentMethod | Alphanumeric | 255 | Payment method used in the payment, for example VISA. | — |
lapPaymentMethodType | Alphanumeric | 255 | Payment method type used in the payment, for example CREDIT_CARD. | — |
lapTransactionState | Alphanumeric | 32 | Transaction status. See the transaction status in the given column. |
— |
message | Alphanumeric | 255 | Description of the transaction status. | — |
extra1 | Alphanumeric | 255 | Additional field to send information about the purchase. | — |
extra2 | Alphanumeric | 255 | Additional field to send information about the purchase. | — |
extra3 | Alphanumeric | 255 | Additional field to send information about the purchase. | — |
authorizationCode | Alphanumeric | 12 | Authorization Code of the sale. | — |
merchant_address | Alphanumeric | 255 | Merchant’s address. | — |
merchant_name | Alphanumeric | 255 | Merchant’s_name | — |
merchant_url | Alphanumeric | 255 | Merchant’s website URL. | — |
orderLanguage | Alphanumeric | 2 | Language of the order (ISO-639-1). | — |
pseCycle | Numeric | — | Identifier generated by PSE. | PSE Colombia |
pseReference1 | Alphanumeric | 255 | Reference no. 1 for PSE payments. | PSE Colombia |
pseReference2 | Alphanumeric | 255 | Reference no. 2 for PSE payments. | PSE Colombia |
pseReference3 | Alphanumeric | 255 | Reference no. 3 for PSE payments. | PSE Colombia |
telephone | Alphanumeric | 20 | Merchant’s phone number. | — |
transactionId | Alphanumeric | 36 | Transaction identifier. | — |
trazabilityCode | Alphanumeric | 64 | Traceability Code of the sale on the merchant’s site. | — |
TX_ADMINISTRATIVE_FEE | Decimal (#.00) | — | Value of the administrative fee. | — |
TX_TAX_ADMINISTRATIVE_FEE | Decimal (#.00) | — | Value of the tax of the administrative fee. | — |
TX_TAX_ADMINISTRATIVE_FEE_RETURN_BASE | Decimal (#.00) | — | Base value of the administrative fee for the tax refund. | — |
action_code_description | Alphanumeric | 255 | VISANET response code description. | VISANET Peru |
cc_holder | Alphanumeric | 150 | Name of cardholder. | VISANET Peru |
cc_number | Alphanumeric | — | Credit card number. | VISANET Peru |
processing_date_time | Date (YYYY-MM-DD) | — | Date of the sale’s processing. | VISANET Peru |
request_number | Alphanumeric | 9 | Order Number + transaction identifier | VISANET Peru |
Integrate the response page
The following is an example in PHP of how you can integrate the response page:
<?php
$ApiKey = "4Vj8eK4rloUd272L48hsrarnUA";
$merchant_id = $_REQUEST['merchantId'];
$referenceCode = $_REQUEST['referenceCode'];
$TX_VALUE = $_REQUEST['TX_VALUE'];
$New_value = number_format($TX_VALUE, 1, '.', '');
$currency = $_REQUEST['currency'];
$transactionState = $_REQUEST['transactionState'];
$firma_cadena = "$ApiKey~$merchant_id~$referenceCode~$New_value~$currency~$transactionState";
$firmacreada = md5($firma_cadena);
$firma = $_REQUEST['signature'];
$reference_pol = $_REQUEST['reference_pol'];
$cus = $_REQUEST['cus'];
$extra1 = $_REQUEST['description'];
$pseBank = $_REQUEST['pseBank'];
$lapPaymentMethod = $_REQUEST['lapPaymentMethod'];
$transactionId = $_REQUEST['transactionId'];
if ($_REQUEST['transactionState'] == 4 ) {
$estadoTx = "Transaction approved";
}
else if ($_REQUEST['transactionState'] == 6 ) {
$estadoTx = "Transaction rejected";
}
else if ($_REQUEST['transactionState'] == 104 ) {
$estadoTx = "Error";
}
else if ($_REQUEST['transactionState'] == 7 ) {
$estadoTx = "Pending payment";
}
else {
$estadoTx=$_REQUEST['mensaje'];
}
if (strtoupper($firma) == strtoupper($firmacreada)) {
?>
<h2>Transaction Summary</h2>
<table>
<tr>
<td>Transaction status</td>
<td><?php echo $estadoTx; ?></td>
</tr>
<tr>
<tr>
<td>Transaction ID</td>
<td><?php echo $transactionId; ?></td>
</tr>
<tr>
<td>Reference sale</td>
<td><?php echo $reference_pol; ?></td>
</tr>
<tr>
<td>Reference transaction</td>
<td><?php echo $referenceCode; ?></td>
</tr>
<tr>
<?php
if($pseBank != null) {
?>
<tr>
<td>cus </td>
<td><?php echo $cus; ?> </td>
</tr>
<tr>
<td>Bank </td>
<td><?php echo $pseBank; ?> </td>
</tr>
<?php
}
?>
<tr>
<td>total amount</td>
<td>$<?php echo number_format($TX_VALUE); ?></td>
</tr>
<tr>
<td>Currency</td>
<td><?php echo $currency; ?></td>
</tr>
<tr>
<td>Description</td>
<td><?php echo ($extra1); ?></td>
</tr>
<tr>
<td>Entity:</td>
<td><?php echo ($lapPaymentMethod); ?></td>
</tr>
</table>
<?php
}
else
{
?>
<h1>Error validating digital signature.</h1>
<?php
}
?>
GET example sent to the response page.
http://mytestsite.com/response.php?&merchantId=508029&merchant_name=Test+PayU+Test&merchant_address=Av+123+Calle+12&telephone=7512354&merchant_url=http%3A%2F%2Fpruebaslapv.xtrweb.com&transactionState=6&lapTransactionState=DECLINED&message=Declinada&referenceCode=2015-05-27+13%3A04%3A37&reference_pol=7069375&transactionId=f5e668f1-7ecc-4b83-a4d1-0aaa68260862&description=test_payu_01&trazabilityCode=&cus=&orderLanguage=es&extra1=&extra2=&extra3=&polTransactionState=6&signature=e1b0939bbdc99ea84387bee9b90e4f5c&polResponseCode=5&lapResponseCode=ENTITY_DECLINED&risk=1.00&polPaymentMethod=10&lapPaymentMethod=VISA&polPaymentMethodType=2&lapPaymentMethodType=CREDIT_CARD&installmentsNumber=1&TX_VALUE=100.00&TX_TAX=.00¤cy=USD&lng=es&pseCycle=&buyerEmail=test%40payulatam.com&pseBank=&pseReference1=&pseReference2=&pseReference3=&authorizationCode=&TX_ADMINISTRATIVE_FEE=.00&TX_TAX_ADMINISTRATIVE_FEE=.00&TX_TAX_ADMINISTRATIVE_FEE_RETURN_BASE=.00
Signature validation
The signature validation allows you to check the data integrity, you must generate the signature with the information you find in the response page and compare it with the information from the signature parameter.
To validate the signature in the response page, you should consider:
- To get the new value
new_value
, approximate theTX_VALUE
to a decimal, using the rounding method Round half to even:- If the first decimal is even and the second is
5
, round it to the lowest value. - If the first decimal is odd and the second is
5
, round it to the higher value. - Otherwise you must round it to the nearest decimal.
- If the first decimal is even and the second is
- Get the parameters to generate the signature (
merchantId
,referenceCode
,TX_VALUE
,currency
, andtransactionState
) from the response page, do not get them from your database. - You must store your ApiKey safely.
- Create the signature as follows:
"ApiKey~merchantId~referenceCode~new_value~currency~transactionState"
Examples:
First decimal is an even number and the second is 5
Your apiKey: 4Vj8eK4rloUd272L48hsrarnUA
Parameters get from the response page:
- merchantId = 508029
- referenceCode = TestPayU04
- TX_VALUE = 150.25
- currency = USD
- transactionState = 6
The signature is generated as follows:
MD5(4Vj8eK4rloUd272L48hsrarnUA~508029~TestPayU04~150.2~USD~6) = 00286dc735bd9eaa8ae3a3a4cbb40688
signature = 00286dc735bd9eaa8ae3a3a4cbb40688
First decimal is an odd number and the second is 5
Your apiKey: 4Vj8eK4rloUd272L48hsrarnUA
Parameters get from the response page:
- merchantId = 508029
- referenceCode = TestPayU04
- TX_VALUE = 150.35
- currency = USD
- transactionState = 6
The signature is generated as follows:
MD5(4Vj8eK4rloUd272L48hsrarnUA~508029~TestPayU04~150.4~USD~6) = 9df2bb60e2838170009040982967923f
signature = 9df2bb60e2838170009040982967923f
Other cases
Your apiKey: 4Vj8eK4rloUd272L48hsrarnUA
Parameters get from the response page:
- merchantId = 508029
- referenceCode = TestPayU04
- TX_VALUE = 150.34
- currency = USD
- transactionState = 6
The signature is generated as follows:
MD5(4Vj8eK4rloUd272L48hsrarnUA~508029~TestPayU04~150.3~USD~6) = 779f163be9347a691bcdb25064644795
signature = 779f163be9347a691bcdb25064644795
Compare your signature
This calculator lets you generate the signature using any of the available encryption methods.
Last modified
November 8, 2024:
Documentation updates (cb34649dc)