PayU's Software Development Kit (SDKs) provides a simple solution for a complex integration.

Similar to any API integration, you can customize your checkout according to your shop's needs and the customer will stay on your site during the purchase and payment process.
developer
 
 

Available features

 
Payments

Payments

Consultas

Queries

Pagos recurrentes

Recurring payments

Tokenización

Tokenization

Reembolsos

Refunds

 
Initial settings by integration  
 
In order to make the connection to the API, the SDK depends on Apache’s HttpClient library, which in turn depends on the HttpCore, CommonsCodec CommonsLoggin libraries. In general, in order to make use of the SDK, the following libraries should be included in the classpath:
  1. HttpClient-4.2.5.jar
  2. HttpCore-4.2.4.jar
  3. Commons-loggin-1.1.1.jar
  4. Commons-codec-1.6.jar
  5. payu-java-sdk-1.1.4.jar
 
Download Java SDK 1.1.4

Before doing any operation with PayU's SDK, certain initial values must be assigned to the PayU class, which are common for all operations supported by the SDK and are configured depending on the shop. Below is an example of the configuration for this class, including the values, which are listed on the table.

Parameter name Size Type Requested Description
language 2 Language SI The language used for error messages in the system and in emails that are sent to the buyer and seller. It is currently supported in en (English), es (Spanish) and pt (Portuguese).
isTest boolean SI "true" if it is a test request, "false" otherwise. Depending on the type of transaction or operation, the behavior varies depending on the value of this field.
apiLogin Mín: 12 Máx: 32 String SI The merchant’s apiLogin.
apiKey Mín: 6 Máx: 32 String SI The merchant’s apiKey.
merchantId String NO* The merchant identifier, it is used to generate the signatures to verify payment transactions. *Required if you want to check the transaction (unless the signature is sent))
paymentsUrl Mín: 1 String NO The web address of the page to which you will send the payment-related requests. It takes the production URL by default.
reportsUrl Mín: 1 String NO The web address of the page to which you will send the requests related to the reports. It takes the production URL by default.
 
 
Example

PayU.apiKey = "xxxxxxxxxxxx"; //Enter your ApiKey here.
PayU.apiLogin = "xxxxxxxxxxxx"; //Enter your apiLogin here.
PayU.language = Language.en; //Enter the language you prefer here
PayU.isTest = false; //Leave it true when testing..
LoggerUtil.setLogLevel(Level.ALL); //Include it only if you want to see all the trace of the log; if you want to see the response only, you can delete it.
PayU.paymentsUrl = "https://api.payulatam.com/payments-api/"; //Include it only if you want to test a specific payment server, and display the route of the same.
PayU.reportsUrl = "https://api.payulatam.com/reports-api/"; //Include it only if you want to test it in a specific query server, and indicate the path of the same.
 
To execute each of the operations provided by PayU's SDK, you must send a parameter map as an argument to the corresponding method, which contains all the information of the transaction to be processed.
Map<String, String>  parameters = new HashMap <String, String> ();

parameters.put(PayU.PARAMETERS.TRANSACTION_ID, transactionId);

parameters.put(PayU.PARAMETERS.ORDER_ID, orderId.toString());

For ease of use, a series of constants in the PayU.PARAMETERS, interface are provided, which contain the names of the parameters used in the SDK methods and which will be referenced in each available operation of the manual.

In order to connect to the API, the SDK can be run on machines with versions greater than or equal to 5.2.1 of PHP.  
Additionally the following PHP extensions are required on your server:
  1. curl
  2. xml
  3. mbstring
  4. json
 
Download PHP SDK 4.5.6 Initial Setup: 
To have access to the SDK functionalities, you should include the PayU class located at [ruta/a/payu-php-sdk]/lib/PayU.php.  
<?php
require_once '[ruta/payu-php-sdk]/lib/PayU.php';
...
?>
 
Before performing any operation with the PHP SDK, you must assign some initial values to the PayU class, which are common for all operations supported by the SDK and are configured depending on the shop. An example of the configuration of this class is presented below and then the values are listed in a table:  
<?php
PayU::$apiKey = "xxxxxxxxxxxx"; //Enter your own apiKey here.
PayU::$apiLogin = "xxxxxxxxxxxx"; //Enter your own apiLogin here.
PayU::$merchantId = "1"; //Enter your commerce Id here.
PayU::$language = SupportedLanguages::ES; //Select the language.
PayU::$isTest = false; //Leave it True when testing.
...
?>
 
Parameter name Size Type Requested Description
PayU::$language 2 Language SI The language used for error messages in the system and in emails that are sent to the buyer and seller. Currently supported in en (English), es (Spanish) and pt (Portuguese).
PayU::$isTest boolean SI “true” if it is a test request, “false” otherwise. Depending on the type of transaction or operation, the behavior varies subject on the value of this field.
PayU::$apiLogin Mín: 12

Máx: 32

String YES The merchant’s apiLogin.
PayU::$apiKey Mín: 6

Máx: 32

String YES The merchant’s apiKey.
PayU::$merchantId String NO* The shop’s identifier is used to generate the signatures to verify payment transactions. *Required if you want to verify the transaction (unless the signature is sent)
 
Additionally, the API must be configured to direct requests to the appropriate URL using the Environment class as shown below:  
<?php
// Payments URL
Environment::setPaymentsCustomUrl("https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi");
// Queries URL
Environment::setReportsCustomUrl("https://sandbox.api.payulatam.com/reports-api/4.0/service.cgi");
// Subscriptions for recurring payments URL
Environment::setSubscriptionsCustomUrl("https://sandbox.api.payulatam.com/payments-api/rest/v4.3/");
...
?>
 
 
Consider:
  1. You must have an active PayU account.
  2. You must install a valid SSL certificate on your server and your site should be able to make SSL pconnections, which is why the virtual machine must have the appropriate security extensions.
  3. Temporarily, do not use security certificates elliptic curve or those who have the suite of encryption TLS_ECDHE_ECDSA_WITH_RC4_128_SHA in your payment requests.
  4. You must have CGI or server languages such as Java, C#, VB, PHP, etc.
  5. You must be able to store safely your authentication credentials (API Key and API Login).
  6. The encoding for messages must be UTF-8.
  7. The dates and times must follow this order: yyyy-MM-ddTHH:mm:ss. Enter time in the 24-hour format, i.e.: 2015-08-22T21:35:12.
  8. Normally the connection guarantees response times of 3 seconds on average, if there is an abnormal situation the maximum response time will be 1 minute. It is highly recommended that you set the “timeouts” when you connect with PayU.
  9. It is important to validate the length and the credit card numbers per franchise together with the security codes.