Enter at least two characters to search. Searching documentation… No matching sections. Try an endpoint, field or event name.
VeliraPay API
View as MarkdownA small REST API for charging customers in crypto, checking on their payments and getting told the moment one lands. JSON in, JSON out.
On this page
Request examples in cURL, PHP, Laravel, Node.js, Python and C#. Pick a language once and every example follows your choice.
- Base URL https://api.velirapay.com/v1
- Format JSON request bodies and responses, UTF-8
- Rate limit 120 requests per minute per key
- Versioning The version is in the path; breaking changes get a new one
Download the OpenAPI specification for endpoint methods, permissions, request fields and response schemas.
Your first request
Have an owner or admin create an API key under Developers → API keys, send it as a bearer token, and ask the API which account it belongs to and what it can be paid in.
Copy failed. Select the code and copy it manually.
curl 'https://api.velirapay.com/v1/account' \
--fail-with-body --silent --show-error --max-time 30 \
-H "Authorization: Bearer ${VELIRAPAY_API_KEY:?Set VELIRAPAY_API_KEY}" \
-H 'Accept: application/json'
<?php
use VeliraPay\VeliraPayClient;
require __DIR__.'/vendor/autoload.php';
$apiKey = getenv('VELIRAPAY_API_KEY') ?: throw new RuntimeException('Set VELIRAPAY_API_KEY.');
$velirapay = new VeliraPayClient($apiKey, baseUrl: 'https://api.velirapay.com');
$account = $velirapay->account->retrieve();
echo json_encode($account, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR), PHP_EOL;
use VeliraPay\Laravel\Facades\VeliraPay;
$account = VeliraPay::account()->retrieve();
const secretKey = process.env.VELIRAPAY_API_KEY;
if (!secretKey) throw new Error('Set VELIRAPAY_API_KEY.');
const response = await fetch('https://api.velirapay.com/v1/account', {
headers: {
Authorization: `Bearer ${secretKey}`,
Accept: 'application/json',
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) {
throw new Error(`VeliraPay ${response.status}: ${await response.text()}`);
}
const account = response.status === 204 ? null : (await response.json()).data;
console.log(JSON.stringify(account, null, 2));
import json
import os
import requests
api_key = os.environ["VELIRAPAY_API_KEY"]
response = requests.get(
"https://api.velirapay.com/v1/account",
headers={
"Authorization": f"Bearer {api_key}",
"Accept": "application/json",
},
timeout=(5, 30),
allow_redirects=False,
)
if not 200 <= response.status_code < 300:
raise RuntimeError(f"VeliraPay {response.status_code}: {response.text}")
account = None if response.status_code == 204 else response.json()["data"]
print(json.dumps(account, indent=2))
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
var secretKey = Environment.GetEnvironmentVariable("VELIRAPAY_API_KEY")
?? throw new InvalidOperationException("Set VELIRAPAY_API_KEY.");
using var client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false })
{
Timeout = TimeSpan.FromSeconds(30),
};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.velirapay.com/v1/account");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", secretKey);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
using var response = await client.SendAsync(request);
var responseBody = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"VeliraPay {(int)response.StatusCode}: {responseBody}");
}
JsonElement? account = null;
if (response.StatusCode != HttpStatusCode.NoContent)
{
using var document = JsonDocument.Parse(responseBody);
account = document.RootElement.GetProperty("data").Clone();
}
Console.WriteLine(account?.GetRawText() ?? "null");
The root of the API, https://api.velirapay.com/, answers without a key, with its name, status, version and a link to these pages, which makes it a handy health check.
Working in PHP or Laravel, or selling on WooCommerce? The official libraries and plugin handle authentication, retries and webhook signatures for you. See the libraries
Charging a customer
To take a payment from a customer, create a charge with POST /v1/charges. Say how much and in which coin, add whatever you already know about the customer and the order, and send them to the checkout_url that comes back. That is the default, and you do not need a payment link for it.
- Use an invoice when the bill is to be paid later, or the customer should choose the coin on our page.
- Use a payment link for one public page many customers pay through, such as a product or a tip jar. Create it once and share it: do not make a new one per customer or per order.
Charge a customer, step by step
Find your way around
Every page below is one topic. The sidebar keeps them within reach wherever you are.
Getting started
How to charge a customer, the official libraries, then how to authenticate, repeat a request safely, page through a list and read an error.
API reference
Every object and endpoint: the account behind your key, the coins on offer, charges, invoices, payment links, coupons, payouts and events.
Webhooks
Get told the moment a payment lands, prove the delivery came from us, and survive a receiver that is down.
Checkout
What the customer sees between opening a page and the money arriving, and how it reaches your wallet.
AI assistants
Let an assistant charge customers, raise invoices and check what has been paid.
Ready to build?
Create an account, add an API key and a webhook endpoint, and send yourself a test event. Test mode runs on test coins, so trying all of it costs nothing.