Listar subscripciones

Permite obtener un listado pagina de las ultimas subscripciones creadas por el comercio.

Método: POST

Campo

Tipo

Requerido

Descripción

merchant

string

Nombre asignado para el comercio en Payvalida. Se entrega con las credenciales.

request_id

string

id de la operación de búsqueda.

page

string

pagina de búsqueda. Valor por defecto: 1

sort

string

tipo de ordenamiento. Valores permitidos: - DESC - ASC Valor por Defecto: DESC

checksum

string

Cadena de comprobación con SHA512 (merchant+request_id+ FIXED_HASH)

Ejemplos

  • Go

package main

import (
	"bytes"
	"crypto/sha512"
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"net/http"
	"time"
)

func main() {
	url := "https://api-test.payvalida.com/subscriptions/merchants/api/list/subscriptions"

	merchant := "kuanto"
	request_id := "month"
	page := 1
	sort := "DESC"
	fixedHash := "FIXED_HASH"

	checksum := createChecksum(merchant, request_id, fixedHash)

	payload := []byte(fmt.Sprintf(`{
		"merchant": "%s",
		"request_id": "%s",
		"page": "%s",
		"sort": "%s",
		"checksum":"%s",
	}`, merchant, request_id, page, sort, checksum))

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}

	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}

	defer resp.Body.Close()

	// Read response body
	responseData, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response body:", err)
		return
	}

	// Print response data
	fmt.Println("Response:", string(responseData))
}

func createChecksum(merchant, request_id, fixedHash string) string {
	checksumData := merchant + request_id + fixedHash
	hash := sha512.Sum512([]byte(checksumData))
	checksum := hex.EncodeToString(hash[:])
	return checksum
}
  • PHP

  • Javascript

  • Java

  • Python

Last updated