Consult

This operation consists of sending a reference and Payvalida responds with the information of the amount. This reference can be associated with a purchase or recharge order with the document number.

Field

Type

required

Description

reference

int (pathParam)

yes

reference of the query provided by the client.

name

string (queryParam)

yes

Name of the payment network

checksum

string

(queryParam)

yes

Check string, calculated with SHA512(name + reference + FIXED_HASH)

Examples:

  • GO

package main

import (
	"crypto/sha512"
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"net/http"
)
func main() {
	reference := "9999999999"
	red := "COMPLETAR" //Cambiar por nombre de red
	fixedHash := "COMPLETAR" //Completar con el fixedHash
	checksum := sha512.Sum512([]byte(red + reference + fixedHash))
	url := "https://sandbox-cashin.payvalida.com/v1/orders/" + reference + "?name=" + red + "&checksum=" + hex.EncodeToString(checksum[:])
	method := "GET"
	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)
	if err != nil {
		fmt.Println(err)
		return
	}
	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
  • PHP

<?php
$curl = curl_init();
$reference = "9999999999";
$red = "Completar"; //Cambiar por nombre de red
$fixedHash = "Completar"; //Cambiar por la credencial otorgada
$key = $red . $reference . $fixedHash
$checksum = hash('sha512', $key);
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://sandbox-cashin.payvalida.com/v1/orders/" . $reference ."?name=" . $red . "&checksum=" . $checksum,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
  • Java

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://sandbox-cashin.payvalida.com/v1/orders/9999999999?name=BEVALIDA_343&checksum=AA1762CAF3371DBC391B5B09FAB26F3DB88C2B2218371A7DAEBE1382DB0B00CC0D64BF221920C782287CD49CEBF32987D554E8DBA3DE0DD8731F93AB549B9A6E")
  .method("GET", null)
  .build();
Response response = client.newCall(request).execute();
  • Python

import requests
import hashlib
reference = "9999999999"
red = "COMPLETAR" //Cambiar por nombre de red
fixedHash = "COMPLETAR" //Completar con el fixedHash
key = red + reference + fixedHash
checksum = hashlib.sha512(bytes(key, 'utf-8')).hexdigest()
url = "https://sandbox-cashin.payvalida.com/v1/orders/"+reference+"?name="+red+"&checksum="+checksum
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)

Última actualización

¿Te fue útil?