Skip to main content
POST
/
payment-requests
/
reversals
Reverse a payment request by card-provider reference
curl --request POST \
  --url https://api.venlyfinance.com/v1/payment-requests/reversals \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "paymentRequestReference": {
    "cardProviderReference": {
      "type": "paymentology",
      "referenceId": "ACC-12345"
    },
    "externalId": "TID-67890"
  },
  "reason": "NETWORK_DECLINE",
  "description": "Scheme declined after issuer approval",
  "idempotencyKey": "1b4e28ba-2fa1-11d2-883f-0016d3cca427"
}
'
import requests

url = "https://api.venlyfinance.com/v1/payment-requests/reversals"

payload = {
"paymentRequestReference": {
"cardProviderReference": {
"type": "paymentology",
"referenceId": "ACC-12345"
},
"externalId": "TID-67890"
},
"reason": "NETWORK_DECLINE",
"description": "Scheme declined after issuer approval",
"idempotencyKey": "1b4e28ba-2fa1-11d2-883f-0016d3cca427"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
paymentRequestReference: {
cardProviderReference: {type: 'paymentology', referenceId: 'ACC-12345'},
externalId: 'TID-67890'
},
reason: 'NETWORK_DECLINE',
description: 'Scheme declined after issuer approval',
idempotencyKey: '1b4e28ba-2fa1-11d2-883f-0016d3cca427'
})
};

fetch('https://api.venlyfinance.com/v1/payment-requests/reversals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.venlyfinance.com/v1/payment-requests/reversals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'paymentRequestReference' => [
'cardProviderReference' => [
'type' => 'paymentology',
'referenceId' => 'ACC-12345'
],
'externalId' => 'TID-67890'
],
'reason' => 'NETWORK_DECLINE',
'description' => 'Scheme declined after issuer approval',
'idempotencyKey' => '1b4e28ba-2fa1-11d2-883f-0016d3cca427'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.venlyfinance.com/v1/payment-requests/reversals"

payload := strings.NewReader("{\n \"paymentRequestReference\": {\n \"cardProviderReference\": {\n \"type\": \"paymentology\",\n \"referenceId\": \"ACC-12345\"\n },\n \"externalId\": \"TID-67890\"\n },\n \"reason\": \"NETWORK_DECLINE\",\n \"description\": \"Scheme declined after issuer approval\",\n \"idempotencyKey\": \"1b4e28ba-2fa1-11d2-883f-0016d3cca427\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.venlyfinance.com/v1/payment-requests/reversals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paymentRequestReference\": {\n \"cardProviderReference\": {\n \"type\": \"paymentology\",\n \"referenceId\": \"ACC-12345\"\n },\n \"externalId\": \"TID-67890\"\n },\n \"reason\": \"NETWORK_DECLINE\",\n \"description\": \"Scheme declined after issuer approval\",\n \"idempotencyKey\": \"1b4e28ba-2fa1-11d2-883f-0016d3cca427\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.venlyfinance.com/v1/payment-requests/reversals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentRequestReference\": {\n \"cardProviderReference\": {\n \"type\": \"paymentology\",\n \"referenceId\": \"ACC-12345\"\n },\n \"externalId\": \"TID-67890\"\n },\n \"reason\": \"NETWORK_DECLINE\",\n \"description\": \"Scheme declined after issuer approval\",\n \"idempotencyKey\": \"1b4e28ba-2fa1-11d2-883f-0016d3cca427\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "result": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "amount": {
      "fiat": 123,
      "crypto": "<string>"
    },
    "originalAmount": {
      "fiat": 123,
      "crypto": "<string>"
    },
    "settlementAmount": {
      "fiat": 123,
      "crypto": "<string>"
    },
    "settledAmount": {
      "fiat": 123,
      "crypto": "<string>"
    },
    "shortfallAmount": {
      "fiat": 123,
      "crypto": "<string>"
    },
    "currency": "<string>",
    "externalId": "<string>",
    "description": "<string>",
    "settledAt": "2023-11-07T05:31:56Z",
    "reversalDescription": "<string>",
    "reversedAt": "2023-11-07T05:31:56Z",
    "executions": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "walletPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "asset": "<string>",
        "amount": 123,
        "exchangeRate": 123,
        "transactionHash": "<string>",
        "errorMessage": "<string>",
        "createdAt": "2023-11-07T05:31:56Z",
        "updatedAt": "2023-11-07T05:31:56Z"
      }
    ],
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}
{
"success": false,
"errors": [
{
"code": "invalid-request",
"message": "The request contains invalid parameters."
}
]
}
{
"success": false,
"errors": [
{
"code": "unauthenticated",
"message": "Please authenticate to perform this action."
}
]
}
{
"success": false,
"errors": [
{
"code": "forbidden",
"message": "You do not have permission to access this resource."
}
]
}
{
"success": false,
"errors": [
{
"code": "account-not-found",
"message": "The requested resource was not found."
}
]
}
{
"success": false,
"errors": [
{
"code": "concurrent-modification",
"message": "This request has been modified by another user. Please refresh and try again."
}
]
}
{
"success": false,
"errors": [
{
"code": "idempotency-conflict",
"message": "This idempotency key was already used with a different request."
}
]
}
{
"success": false,
"errors": [
{
"code": "internal-error",
"message": "An unexpected error occurred. Please try again later."
}
]
}
Reverses a payment request you identify by its card-provider reference instead of its ID: the account comes from paymentRequestReference.cardProviderReference (type + referenceId) and the request from its externalId. Behavior and response — including the { "fiat": <number>, "crypto": "<string>" } amount objects — match reversing by ID. Send a unique idempotencyKey; repeating the same key and body returns the original result. Concept guide: Payment requests

Authorizations

Body

application/json

Reverses a payment request identified by its card-provider reference.

paymentRequestReference
object
required

Identifies a payment request by the card-provider reference of its account plus the request's externalId — used by the "by reference" settle/reverse endpoints.

reason
enum<string>
required

Why a payment request was reversed (recorded for audit).

Available options:
CUSTOMER_CANCELLATION,
MERCHANT_VOID,
ACQUIRER_FAILURE,
NETWORK_DECLINE,
OTHER
idempotencyKey
string
required

Unique key to prevent duplicate operations on retry

Maximum string length: 255
description
string

Optional free-text reason for the reversal

Maximum string length: 1000

Response

Reversal accepted; on-chain processing is asynchronous

success
boolean

Indicates whether the request was successful

result
object