Skip to main content
POST
/
payment-requests
/
settlements
Settle a payment request by card-provider reference
curl --request POST \
  --url https://api.venlyfinance.com/v1/payment-requests/settlements \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "paymentRequestReference": {
    "cardProviderReference": {
      "type": "paymentology",
      "referenceId": "ACC-12345"
    },
    "externalId": "TID-67890"
  },
  "amount": 25,
  "currency": "USD",
  "idempotencyKey": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}
'
import requests

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

payload = {
    "paymentRequestReference": {
        "cardProviderReference": {
            "type": "paymentology",
            "referenceId": "ACC-12345"
        },
        "externalId": "TID-67890"
    },
    "amount": 25,
    "currency": "USD",
    "idempotencyKey": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}
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'
    },
    amount: 25,
    currency: 'USD',
    idempotencyKey: '7c9e6679-7425-40de-944b-e07fc1f90ae7'
  })
};

fetch('https://api.venlyfinance.com/v1/payment-requests/settlements', 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/settlements",
  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'
    ],
    'amount' => 25,
    'currency' => 'USD',
    'idempotencyKey' => '7c9e6679-7425-40de-944b-e07fc1f90ae7'
  ]),
  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/settlements"

	payload := strings.NewReader("{\n  \"paymentRequestReference\": {\n    \"cardProviderReference\": {\n      \"type\": \"paymentology\",\n      \"referenceId\": \"ACC-12345\"\n    },\n    \"externalId\": \"TID-67890\"\n  },\n  \"amount\": 25,\n  \"currency\": \"USD\",\n  \"idempotencyKey\": \"7c9e6679-7425-40de-944b-e07fc1f90ae7\"\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/settlements")
  .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  \"amount\": 25,\n  \"currency\": \"USD\",\n  \"idempotencyKey\": \"7c9e6679-7425-40de-944b-e07fc1f90ae7\"\n}")
  .asString();
require 'uri'
require 'net/http'

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

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  \"amount\": 25,\n  \"currency\": \"USD\",\n  \"idempotencyKey\": \"7c9e6679-7425-40de-944b-e07fc1f90ae7\"\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."
    }
  ]
}
Settles 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 settling by ID. Send a unique idempotencyKey; repeating the same key and body returns the original result. Concept guide: Payment requests

Authorizations

Body

application/json

Settles 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.

amount
number
required

Final settlement amount, in the authorized fiat currency

currency
string
required

Must match the authorized currency

Minimum string length: 1
idempotencyKey
string
required

Unique key to prevent duplicate operations on retry

Minimum string length: 1

Response

Settlement accepted; on-chain processing is asynchronous

success
boolean

Indicates whether the request was successful

result
object