NAV Navbar
Logo
shell java php

Introduction

Wellcome to PayValida API, an easy way to create payment orders to get payments for your products or services using all payment alternatives we ofer.

We have code snippets for shell, php and Java.

For further information please visit: PayValida.

Payment Orders

Getting all Payment Orders

curl -i -X GET \
 'https://sandbox-api-merchants.payvalida.com/api/v2/porders/?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8'
        try {
            // Sandbox
            String urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";
            // Production
            // String urlAPI = "https://api-merchants.payvalida.com/api/v2/porders/";

            //You must change merchantID by you merchant
            String merchantID = "testmerchant_co";

            //Calculate checksum
            String checksum = "eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8";

            URL url = new URL(urlAPI + "?merchant=" + merchantID + "&checksum=" + checksum);

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
<?php

    /**
        You need activarte curl support in your PHP
        If you're on Windows:
            Go to your php.ini file and remove the ; mark from the beginning of the following line:
            ;extension=php_curl.dll
            After you have saved the file you must restart your HTTP server software (e.g. Apache) before this can take effect.
        If you're on Linux:
            In a terminal type the following to install it and do not forgot to restart server.
            sudo apt-get install php-curl
    **/

    // Sandbox
    $service_url = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";

    // Production
    //$service_url = "https://api-merchants.payvalida.com/api/v2/porders/";


    //You must change merchantID by you merchant
    $merchantId = "testmerchant_co";

    //Calculate checksum
    $checksum  = "eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8";

    $service_url = $urlAPI."?merchant=".$merchantId."&checksum=".$checksum;

    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ["Content-Type:application/json"]);  
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $curl_response = curl_exec($curl);
    curl_close($curl);

    var_dump($curl_response);

?>

Returns a JSON response like:

{  
   "CODE":"0000",
   "DATA":[  
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":null,
         "UPDATE_DATE":"2017-08-03 05:44:33",
         "CREATION_DATE":"2017-08-02 11:25:54",
         "STATE":"CANCELADA",
         "PAYMENT_METHOD":"baloto",
         "EMAIL":"[email protected]",
         "LIFETIME":"684h",
         "RECURRENCY":false,
         "ORDER":"p0000001",
         "CODE":95456,
         "AMOUNT":"75,000.00",
         "DESCRIPTION":"Prueba REST OCUMejorado",
         "REFERENCE":"989898001"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-04 12:22:24",
         "CREATION_DATE":"2017-08-01 17:22:20",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"1501626139562",
         "CODE":95440,
         "AMOUNT":"10,000.00",
         "DESCRIPTION":"Test GATEWAY",
         "REFERENCE":"1501626139562"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-04 11:48:49",
         "CREATION_DATE":"2017-08-01 16:25:59",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"1501622759125",
         "CODE":95439,
         "AMOUNT":"10,000.00",
         "DESCRIPTION":"Test GATEWAY",
         "REFERENCE":"1501622759125"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-04 11:48:49",
         "CREATION_DATE":"2017-08-01 16:22:32",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"1501622551771",
         "CODE":95438,
         "AMOUNT":"10,000.00",
         "DESCRIPTION":"Test GATEWAY",
         "REFERENCE":"1501622551771"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-04 11:18:04",
         "CREATION_DATE":"2017-08-01 16:12:25",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"1501621945247",
         "CODE":95437,
         "AMOUNT":"10,000.00",
         "DESCRIPTION":"Test GATEWAY",
         "REFERENCE":"1501621945247"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-01 09:12:48",
         "CREATION_DATE":"2017-08-01 14:11:04",
         "STATE":"APROBADA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"1501614664343",
         "CODE":95435,
         "AMOUNT":"5,000.00",
         "DESCRIPTION":"Prueba",
         "REFERENCE":"1501614664343"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-08-04 07:44:28",
         "CREATION_DATE":"2017-08-01 12:01:55",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"TC",
         "EMAIL":"[email protected]",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"MTUwMTYwMzgyNTM4NTg5MDY0MjEyNjYwMTU1",
         "CODE":95434,
         "AMOUNT":"5,000.00",
         "DESCRIPTION":"Prueba",
         "REFERENCE":"1501606915582"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-07-22 06:18:25",
         "CREATION_DATE":"2017-07-19 10:47:38",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"10,230",
         "EMAIL":"[email protected]_co.com",
         "LIFETIME":"72",
         "RECURRENCY":false,
         "ORDER":"testmerchant_co1500479244517",
         "CODE":95236,
         "AMOUNT":"20,000.00",
         "DESCRIPTION":"Order-testmerchant_co1500479244517",
         "REFERENCE":"34474798"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-07-22 12:18:26",
         "CREATION_DATE":"2017-07-14 08:35:32",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"tc",
         "EMAIL":"[email protected]_co.com",
         "LIFETIME":"200h",
         "RECURRENCY":false,
         "ORDER":"1500039330728",
         "CODE":95124,
         "AMOUNT":"20,000.00",
         "DESCRIPTION":"Prueba Link de Pago",
         "REFERENCE":"1500037122481"
      },
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-07-21 22:18:24",
         "CREATION_DATE":"2017-07-13 19:11:24",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"tc",
         "EMAIL":"[email protected]tmerchant_co.com",
         "LIFETIME":"200h",
         "RECURRENCY":false,
         "ORDER":"1499991083599",
         "CODE":95083,
         "AMOUNT":"67,500.00",
         "DESCRIPTION":"Prueba Link de Pago",
         "REFERENCE":"1499991056501"
      }
   ],
   "LINKS":{  
      "PREV":"https://sandbox-api-merchants.payvalida.com/api/v2/porders/?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8&limit=10&offset=0",
      "NEXT":"https://sandbox-api-merchants.payvalida.com/api/v2/porders/?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8&limit=10&offset=20",
      "SELF":"https://sandbox-api-merchants.payvalida.com/api/v2/porders/?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8&limit=10&offset=10"
   },
   "DESC":"Resultado exitoso"
}

Use it to get all payment orders regitered.

HTTP Request

Sandbox:
GET https://sandbox-api-merchants.payvalida.com/api/v2/porders
Production:
GET https://api-merchants.payvalida.com/api/v2/porders

Query Params

Name Required Description Type Length
merchant yes Merchant identificacion assigned by payvalida Alphanumeric 50 characters
checksum yes String to check the request. It is generated using SHA512(merchant + FIXED_HASH) Alphanumeric 512 characters
limit no Controls the maximum number of items that may be returned for a single request (default: 10) Numeric N/A
offset no Controls the starting point within the collection of resource results (default: 0) Numeric N/A

Getting a single payment order

  curl -i -X GET \
 'https://sandbox-api-merchants.payvalida.com/api/v2/porders/1496953766724_6?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8'
  try {
            // Sandbox
            String urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";
            // Production
            // String urlAPI = "https://api-merchants.payvalida.com/api/v2/porders/";

            //Change orderID by you order
            String orderID = "1500037122481";

            //Change merchantID by you merchant
            String merchantID = "testmerchant_co";

            //Calculate checksum
            String checksum = "547c85b4575b2a9188e0677d38147941aab3be14d45b87393f4339ffd415017bf2af78653968f920d546c2e67e6ae8d40601dba82019349109b4e0ae0603b592";

            URL url = new URL(urlAPI + orderID + "?merchant=" + merchantID + "&checksum=" + checksum);

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

<?php

    /**
        You need activarte curl support in your PHP
        If you're on Windows:
            Go to your php.ini file and remove the ; mark from the beginning of the following line:
            ;extension=php_curl.dll
            After you have saved the file you must restart your HTTP server software (e.g. Apache) before this can take effect.
        If you're on Linux:
            In a terminal type the following to install it and do not forgot to restart server.
            sudo apt-get install php-curl
    **/

    // Sandbox
    $urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";

    // Production
    //$service_url = "https://api-merchants.payvalida.com/api/v2/porders/";

    //Change orderID by you order
    $orderID = "1500037122481";

    //You must change merchantID by you merchant
    $merchantId = "testmerchant_co";

    //Calculate checksum
    $checksum  = "eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8";

    $service_url = $urlAPI.$orderID."?merchant=".$merchantId."&checksum=".$checksum;

    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ["Content-Type:application/json"]);  
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $curl_response = curl_exec($curl);
    curl_close($curl);

    var_dump($curl_response);
    ?>

Returns a JSON response like:

{  
   "CODE":"0000",
   "DATA":[  
      {  
         "CURRENCY":"COP",
         "NOTIFICATION_RESPONSE":"Notificacion no enviada al comercio: URL de Notificacion en NULL",
         "UPDATE_DATE":"2017-07-22 12:18:26",
         "CREATION_DATE":"2017-07-14 08:35:32",
         "STATE":"VENCIDA",
         "PAYMENT_METHOD":"tc",
         "EMAIL":"[email protected]_co.com",
         "LIFETIME":"200h",
         "RECURRENCY":false,
         "ORDER":"1500039330728",
         "CODE":95124,
         "AMOUNT":"20,000.00",
         "DESCRIPTION":"Prueba Link de Pago",
         "REFERENCE":"1500037122481"
      }
   ],
   "DESC":"Resultado exitoso"
}

Fetches the details for a single payment order

HTTP Request

Sandbox:
GET https://sandbox-api-merchants.payvalida.com/api/v2/porders/<order>
Production:
GET https://api-merchants.payvalida.com/api/v2/porders/<order>

Query Params

Name Required Description Type Length
merchant yes Merchant identificacion assigned by payvalida Alphanumeric 50 characters
checksum yes String to check the request. It is generated using SHA512(merchant + FIXED_HASH) Alphanumeric 512 characters

PATH Params

Name Required Description Type Length
order yes Order identification generated by merchant Alphanumeric 200 characters

Creating a new payment order

  curl -i -X POST \
   -H "Content-Type:application/json" \
   -d \
'{
  "country":343,
  "email":"[email protected]",
  "merchant":"testmerchant_co",
  "order":"p0000101",
  "reference":"989898101",
  "money":"COP",
  "amount":"45000",
  "description":"Test RESTfull Purchase Order POST",
  "language":"es",
  "recurrent":false,
  "expiration":"30/08/2017",
  "method":"baloto",
  "iva":"0.02",
  "checksum":"71ff0ca3ffa49f0d13c7de5c661c6f8fddcab38004a195718e3d89d330005ee34623959e93893cc2ff5f451b89b43dcc514c5767a2415066578adecbd4ef8242"
}' \
 'https://sandbox-api-merchants.payvalida.com/api/v2/porders'
        try {
            // Sandbox
            String urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";
            // Production
            // String urlAPI = "https://api-merchants.payvalida.com/api/v2/porders/";

            URL url = new URL(urlAPI);


            String data = "{\"country\":343,\"email\":\"[email protected]\",\"merchant\":\"testmerchant_co\",\"order\":\"p0000101\",\"reference\":\"989898001\",\"money\":\"COP\",\"amount\":\"45000\",\"description\":\"Test RESTfull service\",\"language\":\"es\",\"recurrent\":false,\"expiration\":\"30/08/2017\",\"method\":\"baloto\","iva":"0.02",\"checksum\":\"71ff0ca3ffa49f0d13c7de5c661c6f8fddcab38004a195718e3d89d330005ee34623959e93893cc2ff5f451b89b43dcc514c5767a2415066578adecbd4ef8242\"}";

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
            conn.setRequestProperty("Accept", "application/json");

            try {
                OutputStream out = conn.getOutputStream();
                out.write(data.getBytes());
                out.flush();
                out.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    <?php
    /**
        You need activarte curl support in your PHP
        If you're on Windows:
            Go to your php.ini file and remove the ; mark from the beginning of the following line:
            ;extension=php_curl.dll
            After you have saved the file you must restart your HTTP server software (e.g. Apache) before this can take effect.
        If you're on Linux:
            In a terminal type the following to install it and do not forgot to restart server.
            sudo apt-get install php-curl
    **/

    // Sandbox
    $urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";

    // Production
    //$service_url = "https://api-merchants.payvalida.com/api/v2/porders/";

    $data = "{\"country\":343,\"email\":\"[email protected]\",\"merchant\":\"testmerchant_co\",\"order\":\"p0000101\",\"reference\":\"989898001\",\"money\":\"COP\",\"amount\":\"45000\",\"description\":\"Test RESTfull service\",\"language\":\"es\",\"recurrent\":false,\"expiration\":\"30/08/2017\",\"method\":\"baloto\","iva":"0.02",\"checksum\":\"71ff0ca3ffa49f0d13c7de5c661c6f8fddcab38004a195718e3d89d330005ee34623959e93893cc2ff5f451b89b43dcc514c5767a2415066578adecbd4ef8242\"}";

    $service_url = $urlAPI;

    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    $curl_response = curl_exec($curl);
    curl_close($curl);

    var_dump($curl_response);

    ?>

Returns a JSON response like:

{  
   "CODE":"0000",
   "DATA":{  
      "OrdenID":"p0000101",
      "Monto":"45000.0",
      "PVordenID":"95601",
      "Referencia":"989898101",
      "Operacion":"CREADA",
      "checkout":"checkout.payvalida.com/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNRVJDSEFOVF9DRUwiOiIzMTc2ODI3MzQxIiwiT1JERVJfTUVUSE9EIjoiZWZlY3R5IiwiTUVSQ0hBTlRfQ09ERSI6MjU0LCJNRVJDSEFOVF9FTUFJTCI6ImhyZXN0cmVwb0BwYXl2YWxpZGEuY29tIiwiaXNzIjoiYXV0aDAiLCJNRVJDSEFOVF9MT0dPIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3ZhbGlkZGF3ZWIvZXZlbnRvcy9mZW5hbGNvYnJhLnBuZyIsIk1FUkNIQU5UX1VSTF9SRVRVUk4iOiJ3d3cucGludmFsaWRkYS5jb20uY28iLCJNRVJDSEFOVF9OQU1FIjoiSGVybmFuIFJwbyAoQ09MKSIsIk9SREVSX0JSSUVGIjoiVGVzdCBSRVNUZnVsbCBQdXJjaGFzZSBPcmRlciBQT1NUIiwiTUVSQ0hBTlRfVEVMIjoiMjg4MDUzOSIsIk9SREVSX0NVUlJFTkNZIjoiQ09QIiwiT1JERVJfQU1PVVQiOiIxMCwwMDAuMDAiLCJleHAiOjE1MzA0MDE1MzgsIk9SREVSX1JFRkVSRU5DRSI6IjQyMzEzIn0.QVsZwm-2BIkK-5RgrAX2NuwGqmHSNHD_zw91i1hcSc8"
   },
   "DESC":"OK"
}

Create a new payment order

HTTP Request

Sandbox:
POST https://sandbox-api-merchants.payvalida.com/api/v2/porders
Production:
POST https://api-merchants.payvalida.com/api/v2/porders

POST params (format: JSON)

Name Required Description Type Length
merchant yes Merchant identificacion assigned by payvalida Alphanumeric 50 characters
email no Customer email Email 100 characters
country yes Country code Numeric 3 characters
order yes Order identification generated by merchant Alphanumeric 200 characters
reference no Number used by customer to pay Numeric 25 characters
money yes Currency code Alphabetic 3 characters
amount yes Transaction Amount Numeric N/A
description yes Purchase description Alphanumeric 500 characters
method yes Payment method Alphanumeric 25 characters
language no Language code for description response messages (en, es) Alphabetic 2 characters
recurrent yes Whether the purchase order is recurring or not Boolean N/A
expiration yes Expiration date. Format: DD/MM/AAAA Date N/A
iva yes Value-added tax (Percentag) Numeric N/A
checksum yes String to check the request. It is generated using SHA512(email + country + order + money + amount + FIXED_HASH) Alphanumeric 512 characters

Update a single payment order

  curl -i -X PATCH \
   -H "Content-Type:application/json" \
   -d \
'{
  "country":343,
  "email":"[email protected]",
  "merchant":"testmerchant_co",
  "order":"p0000101",
  "reference":"989898101",
  "money":"COP",
  "amount":"55000",
  "description":"Test RESTfull Orden de Compra POST",
  "language":"es",
  "recurrent":false,
  "expiration":"30/08/2017",
  "method":"baloto",
  "iva":"0.03",
  "checksum":"721875a77986f35f6a22017e8e8410233c79816e4646dc5ec8e94e0593ea6e2e0ba7d32adc0384064d6659021519574f3cabf7f58ab56571da7a4b8bad1ecab0"
}' \
 'https://sandbox-api-merchants.payvalida.com/api/v2/porders'
        try {
            // Sandbox
            String urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";
            // Production
            // String urlAPI = "https://api-merchants.payvalida.com/api/v2/porders/";

            URL url = new URL(urlAPI);

            String data = "{\"country\":343,\"email\":\"[email protected]\",\"merchant\":\"testmerchant_co\",\"order\":\"p0000201\",\"reference\":\"989898001\",\"money\":\"COP\",\"amount\":\"55000\",\"description\":\"Test RESTfull service\",\"language\":\"es\",\"recurrent\":false,\"expiration\":\"30/08/2017\",\"method\":\"baloto\","iva":"0.03",\"checksum\":\"adf64b3ed1107943588a6f37fd6faea38689dec1927e53831494d1751854acfd511fd1a7d3b5a31936153edb7c862e7fe7e5b326882e627f0088a3a32d785441\"}";

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        //Java don't accept method PATCH, use PUT
        conn.setRequestMethod("PUT");
        conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Accept", "application/json");

            try {
                OutputStream out = conn.getOutputStream();
                out.write(data.getBytes());
                out.flush();
                out.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    <?php
    /**
        You need activarte curl support in your PHP
        If you're on Windows:
            Go to your php.ini file and remove the ; mark from the beginning of the following line:
            ;extension=php_curl.dll
            After you have saved the file you must restart your HTTP server software (e.g. Apache) before this can take effect.
        If you're on Linux:
            In a terminal type the following to install it and do not forgot to restart server.
            sudo apt-get install php-curl
    **/

    // Sandbox
    $service_url = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";

    // Production
    //$service_url = "https://api-merchants.payvalida.com/api/v2/porders/";

    $data = "{\"country\":343,\"email\":\"[email protected]\",\"merchant\":\"testmerchant_co\",\"order\":\"p0000101\",\"reference\":\"989898001\",\"money\":\"COP\",\"amount\":\"45000\",\"description\":\"Test RESTfull service\",\"language\":\"es\",\"recurrent\":false,\"expiration\":\"30/08/2017\",\"method\":\"baloto\","iva":"0.03",\"checksum\":\"71ff0ca3ffa49f0d13c7de5c661c6f8fddcab38004a195718e3d89d330005ee34623959e93893cc2ff5f451b89b43dcc514c5767a2415066578adecbd4ef8242\"}";

    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
    $curl_response = curl_exec($curl);
    curl_close($curl);

    var_dump($curl_response);
    ?>

Returns a JSON response like:

{  
   "CODE":"0000",
   "DATA":{  
      "OrdenID":"p0000201",
      "Monto":"55000.0",
      "PVordenID":"95601",
      "Referencia":"989898101",
      "Operacion":"ACTUALIZADO"
   },
   "DESC":"OK"
}

Udates a single payment order

This method allows you to change the properties of a single payment order like the expiration date, amount, description, etc.

HTTP Request

Sandbox:
PATCH https://sandbox-api-merchants.payvalida.com/api/v2/porders
Production:
PATCH https://api-merchants.payvalida.com/api/v2/porders

PATCH Params (format: JSON)

Name Required Description Type Length
merchant yes Merchant identificacion assigned by payvalida Alphanumeric 50 characters
email no Customer email for payment notification Email 100 characters
country yes Country code Numeric 3 characters
order yes Order identification generated by merchant Alphanumeric 200 characters
reference yes Number used by customer to pay Numeric 25 characters
money yes Currency code Alphabetic 3 characters
amount yes Transaction Amount Numeric N/A
description yes Purchase description Alphanumeric 500 characters
method yes Payment method Alphanumeric 25 characters
language no Language code for description response messages (en, es) Alphabetic 2 characters
recurrent yes Whether the purchase order is recurring or not Boolean N/A
expiration yes Expiration date. Format: DD/MM/AAAA Date N/A
iva yes Value-added tax (Percentag) Numeric N/A
checksum yes String to check the request. It is generated using SHA512(email + country + order + money + amount + FIXED_HASH) Alphanumeric 512 characters

Delete a single payment order

Mark a sinlge payment order as delete

    curl -i -X DELETE \
    'https://sandbox-api-merchants.payvalida.com/api/v2/porders/1496953766724_6?merchant=testmerchant_co&checksum=eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8'
  try {
            // Sandbox
            String urlAPI = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";
            // Production
            // String urlAPI = "https://api-merchants.payvalida.com/api/v2/porders/";

            //Change orderID by you order
            String orderID = "1496953766724_6";

            //Change merchantID by you merchant
            String merchantID = "testmerchant_co";

            //Calculate checksum
            String checksum = "547c85b4575b2a9188e0677d38147941aab3be14d45b87393f4339ffd415017bf2af78653968f920d546c2e67e6ae8d40601dba82019349109b4e0ae0603b592";

            URL url = new URL(urlAPI + orderID + "?merchant=" + merchantID + "&checksum=" + checksum);

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("DELETE");
            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    <?php
    /**
        You need activarte curl support in your PHP
        If you're on Windows:
            Go to your php.ini file and remove the ; mark from the beginning of the following line:
            ;extension=php_curl.dll
            After you have saved the file you must restart your HTTP server software (e.g. Apache) before this can take effect.
        If you're on Linux:
            In a terminal type the following to install it and do not forgot to restart server.
            sudo apt-get install php-curl
    **/

    // Sandbox
    $service_url = "https://sandbox-api-merchants.payvalida.com/api/v2/porders/";

    // Production
    //$service_url = "https://api-merchants.payvalida.com/api/v2/porders/";

    //Change orderID by you order
    $orderID = "1496953766724_6";

    //Change merchantID by you merchant

    $merchantId = "testmerchant_co";

    //Calculate checksum

    $checksum = "eef0c07f779252b735c67df2c1945b68ca93f72100ece73dac778964aca909184cbcb16bd698527ee5738a88e809202284fec8df640a9e12e90f11f4ddb4f3a8";

    $service_url = $urlAPI.$orderID."?merchant=".$merchantId."&checksum=".$checksum;

    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
    $curl_response = curl_exec($curl);
    curl_close($curl);

    var_dump($curl_response);
    ?>

Returns a JSON response like:

{  
   "CODE":"0000",
   "DATA":{  
      "Reference":"3102292330",
      "Amount":"0.0",
      "Operation":"DELETED",
      "OrderID":"1496953766724_6",
      "PVOrderID":"95585"
   },
   "DESC":"OK"
}

HTTP Request

Sandbox:
DELETE https://sandbox-api-merchants.payvalida.com/api/v2/porders/<order>
Production:
DELETE https://api-merchants.payvalida.com/api/v2/porders/<order>

Query Params

Name Required Description Type Length
merchant yes Merchant identificacion assigned by payvalida Alphanumeric 50 characters
checksum yes String to check the request. It is generated using SHA512(order + FIXED_HASH) Alphanumeric 512 characters

PATH Params

Name Required Description Type Length
order yes Order identification generated by merchant Alphanumeric 200 characters

Country/Currency

Code Currency Country
343 COP Colombia
345 USD Ecuador
348 PEN PerĂș
314 COL Costa Rica

Payment WebHook

The Payment WebHook is an HTTP callback: an HTTP POST that occurs when something happens with a single payment order; a simple event-notification via HTTP POST.

In order to process the http post we make, you will need to create a simple web service to handle it.

When the payment state change we will make an HTTP POST (notification) whit the following data:

POST Params

Name Description
pv_po_id Payment id at Payvalida
po_id It’s the value “order” that was registred by the merchant
status The payment state
pv_checksum String to check the request. It is generated using SHA256(po_id + status + FIXED_HASH)
amount Payment amount
iso_currency Payment currency
pv_payment Payment method used by the user

The payment status can change because the following cases:

  1. We recive a payment from the final user (The state change to approved and the notification will be send)
  2. The expitation date has been reached (The state change to canceled and the notification will be send)
  3. The merchant delete the payment order (It won’t be nofified)
  4. The final user claim to refund and it’s aproved (The state change to canceled and the notification will be send)
  5. The merchant wants to refund the payment (The state change to canceled and the notification will be send)

You need to register the webHook url sending an email to [email protected]