Transaction

This operation consists of registering the transaction consulted. For this operation you will only perform the registration and for it to be effective, the confirmation must be made.

Field

Type

Required

Descripción

name

string

yes

Name of the payment network.

checksum

string

yes

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

reference

string

yes

Payment reference

amount

string

yes

Amount of the transaction. It must be equal to the amount returned in the query. unless the query is open amount (0) in which case this amount must be higher.

transaction

string

yes

Unique transaction ID for the payment network

commerce

string

no

Name of the commerce on which the transaction is being carried out.

teller

string

yes

Identification of the collection point. (ip or code of store).

money

string

yes

Transaction currency code **

nombres

string

no

User name

apellido1

string

no

User's first last name

apellido2

string

no

User's second last name

** Transaction currency codes:

Transaction currency codes

Currency - ISO

Country

343

COP

🇨🇴 Colombia

314

CRC

🇨🇷 Costa Rica

345

USD

🇪🇨 Ecuador

348

PEN

🇵🇪 Perú

Examples:

  • GO

package main
import (
	"bytes"
	"crypto/sha512"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)
type Request struct {
	Name        string `json:"name,omitempty"`
	Checksum    string `json:"checksum,omitempty"`
	Reference   string `json:"reference,omitempty"`
	Amount      string `json:"amount,omitempty"`
	Transaction string `json:"transaction,omitempty"`
	Commerce    string `json:"commerce,omitempty"`
	Teller      string `json:"teller,omitempty"`
	Money       string `json:"money,omitempty"`
	Nombres     string `json:"nombres,omitempty"`
	Apellido1   string `json:"apellido1,omitempty"`
	Apellido2   string `json:"apellido2,omitempty"`
}
func main() {
	url := "https://sandbox-cashin.payvalida.com/v1/transactions/"
	method := "POST"
	red := "BEVALIDA_343" //cambiar por el nombre de la red
	amount := "45000"
	reference := "9999999999"
	transaction := "129999999"
	fixedHash := "COMPLETAR" //Completar con la credencial asignada por payvalida
	key := sha512.Sum512([]byte(red + reference + amount + transaction + fixedHash))
	checksum := hex.EncodeToString(key[:])
	request := Request{
		Name:        red,
		Checksum:    checksum,
		Reference:   reference,
		Amount:      amount,
		Transaction: transaction,
		Commerce:    "Payvalida",
		Teller:      "1.1.1.1",
		Money:       "COP",
		Nombres:     "nombre1",
		Apellido1:   "apellido1",
		Apellido2:   "apellido2",
	}
	json, err := json.Marshal(request)
	if err != nil {
		fmt.Println(err)
		return
	}
	client := &http.Client{}
	req, err := http.NewRequest(method, url, bytes.NewBuffer(json))
	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")
	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();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://sandbox-cashin.payvalida.com/v1/transactions/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n    \"name\": \"BEVALIDA_343\",\n    \"reference\": \"9999999999\",\n    \"amount\": \"45000\",\n    \"transaction\": \"129999999\",\n    \"commerce\": \"Payvalida\",\n    \"teller\": \"1.1.1.1\",\n    \"money\": \"COP\",\n    \"checksum\": \"11C4152A38CFE360EE83AB6B991B715774DCE6810BB4DF9F8A91FD79BFC20235CBCD107BC1DC392A43E5D185174978CBAA0874C207CFBDF02D0D63FD504A7E43\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
  • JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"name\": \"BEVALIDA_343\",\n    \"reference\": \"9999999999\",\n    \"amount\": \"45000\",\n    \"transaction\": \"129999999\",\n    \"commerce\": \"Payvalida\",\n    \"teller\": \"1.1.1.1\",\n    \"money\": \"COP\",\n    \"checksum\": \"11C4152A38CFE360EE83AB6B991B715774DCE6810BB4DF9F8A91FD79BFC20235CBCD107BC1DC392A43E5D185174978CBAA0874C207CFBDF02D0D63FD504A7E43\"\n}");
Request request = new Request.Builder()
  .url("https://sandbox-cashin.payvalida.com/v1/transactions/")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
  • PYTHON

import http.client
import mimetypes
conn = http.client.HTTPSConnection("sandbox-cashin.payvalida.com")
payload = "{\n    \"name\": \"BEVALIDA_343\",\n    \"reference\": \"9999999999\",\n    \"amount\": \"45000\",\n    \"transaction\": \"129999999\",\n    \"commerce\": \"Payvalida\",\n    \"teller\": \"1.1.1.1\",\n    \"money\": \"COP\",\n    \"checksum\": \"11C4152A38CFE360EE83AB6B991B715774DCE6810BB4DF9F8A91FD79BFC20235CBCD107BC1DC392A43E5D185174978CBAA0874C207CFBDF02D0D63FD504A7E43\"\n}"
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/v1/transactions/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Última actualización

¿Te fue útil?