Cancelar Suscripción
Permite cancelar una suscripción activa para dejar de recordar al usuario sobre el cobro del servicio, también cambiando el estado como se detalla en el apartado de estados
Producción: https://api.payvalida.com/v4/subscriptions
Campo
Tipo
Requerido
Descripción
merchant
string
sí
Nombre asignado para el comercio en Payválida. Se entrega con las credenciales.
id
string
sí
id de la suscripción que se quiere cancelar
checksum
string
sí
Cadena de comprobación con SHA512 (merchant+id+FIXED_HASH)
curl --location --request DELETE 'https://api-test.payvalida.com/v4/subscriptions' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":"bbc10ac0-81f2-405b-9357-97a435800e95",
"timestamp":1686943428,
"merchant":"kuanto",
"checksum":"31d056705df5318578bb923cced69edeb1e38fd394ac44498363f984256a7fe0fd8563f6ca736ecc8ad12cfddd38ba870755afd594c907e0771fb368329bed2e"
}'Campo
Estructura
Tipo
Descripción
CODE
-
string
Código de respuesta 0000 para OK.
DESC
-
string
Descripción de la respuesta.
{
"CODE": "0000",
"DESC": "OK",
}Cabecera
Valor
Content-Type
application/json
Ejemplos
Go
package main
import (
"crypto/sha512"
"encoding/hex"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
)
func main() {
url := "https://api-test.payvalida.com/v4/subscriptions"
// Prepare the request payload
payload := `{
"id":"bbc10ac0-81f2-405b-9357-97a435800e95",
"merchant":"kuanto",
"checksum":"31d056705df5318578bb923cced69edeb1e38fd394ac44498363f984256a7fe0fd8563f6ca736ecc8ad12cfddd38ba870755afd594c907e0771fb368329bed2e"
}`
// Create a new SHA-512 hasher
hasher := sha512.New()
// Concatenate the values to create the checksum
hasher.Write([]byte("kuanto"))
hasher.Write([]byte("bbc10ac0-81f2-405b-9357-97a435800e95"))
hasher.Write([]byte("FIXED_HASH"))
checksum := hex.EncodeToString(hasher.Sum(nil))
// Update the checksum value in the request payload
payload = strings.Replace(payload, "31d056705df5318578bb923cced69edeb1e38fd394ac44498363f984256a7fe0fd8563f6ca736ecc8ad12cfddd38ba870755afd594c907e0771fb368329bed2e", checksum, 1)
// Create an HTTP DELETE request
req, err := http.NewRequest("DELETE", url, strings.NewReader(payload))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
// Set the request headers
req.Header.Set("Content-Type", "application/json")
// Send the request and get the response
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
// Read the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
// Print the response body
fmt.Println("Response Body:", string(body))
}
PHP
Javascript
Java
Python
Last updated