Response Page
The integration can transmit payment result data via HTTP GET, and your platform can trigger the response page for all transaction statuses, 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 Management Panel. 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
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. |
— |
polTransactionState |
Numeric | 2 | Takes the value from the pol Transaction State .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 |
Integrating the Response Page
The following PHP example shows how to 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
}
?>
Example of GET Request 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
Signature validation allows you to verify the integrity of the data. You must generate a signature using the information provided on the response page and compare it to the value in the signature
parameter.
Important Considerations
- To calculate the new value
new_value
, round theTX_VALUE
to one decimal place using the round half to even method:- If the first decimal digit is even and the second is
5
, round down. - If the first decimal digit is odd and the second is
5
, round up. - In all other cases, round to the nearest decimal normally.
- If the first decimal digit is even and the second is
- Always use the values from the response page (
merchantId
,referenceCode
,TX_VALUE
,currency
, andtransactionState
) to generate the signature. Do not use the values from your database. - Store your API key securely.
- Construct the signature string in the following format:
apiKey~merchantId~referenceCode~new_value~currency~transactionState
Signature Examples
The following examples illustrate how to generate a signature, in this case, using HMAC-SHA256.
First Decimal is an Even Number and the Second is 5
Item | Value |
---|---|
String Parameters | apiKey: 4Vj8eK4rloUd272L48hsrarnUA merchantId: 508029 referenceCode: PayUTest01 TX_VALUE: 150.25 currency: USD transactionState: 6 |
Input String (formatted) | 4Vj8eK4rloUd272L48hsrarnUA~508029~PayUTest01~150.2~USD~6 |
Secret Key (only applicable to HMAC-SHA256) | test123 |
Generated signature |
5ac639cc57ea3ceccef66243f7a20412ea4ae0c86b5121ca6aa67597266057d1 |
First Decimal is an Odd Number and the Second is 5
Item | Value |
---|---|
String Parameters | apiKey: 4Vj8eK4rloUd272L48hsrarnUA merchantId: 508029 referenceCode: PayUTest01 TX_VALUE: 150.35 currency: USD transactionState: 6 |
Input String (formatted) | 4Vj8eK4rloUd272L48hsrarnUA~508029~PayUTest01~150.4~USD~6 |
Secret Key (only applicable to HMAC-SHA256) | test123 |
Generated signature |
7bbb5dd21b3c668bbfec8455c4f4fd3887dff1caa9c5da3895ddd914065b4905 |
Other Cases
Item | Value |
---|---|
String Parameters | apiKey: 4Vj8eK4rloUd272L48hsrarnUA merchantId: 508029 referenceCode: PayUTest01 TX_VALUE: 150.34 currency: USD transactionState: 6 |
Input String (formatted) | 4Vj8eK4rloUd272L48hsrarnUA~508029~PayUTest01~150.3~USD~6 |
Secret Key (only applicable to HMAC-SHA256) | test123 |
Generated signature |
50c8aae35caf923fbdbd791d7842b916ab7d6597b7c4032dd92ab67b7bb43e8a |
Validate Your Signature
Use this generator to create a signature with any of the available encryption methods. This functionality assists you in verifying the signature
value that PayU sends to your response page.