Enter at least two characters to search. Searching documentation… No matching sections. Try an endpoint, field or event name.
Events
View as MarkdownEverything that happens to a charge or an invoice is recorded as an event, the same ones your webhook endpoints receive. Read them here to catch up after downtime, to reconcile without a public endpoint, or to show a customer's payment history.
On this page
The event object
| Field | Type | Description |
|---|---|---|
id
string
|
string | UUID, the same one a webhook payload carries as event_id (not its id, which names the delivery). Use it to skip events you have already handled. |
object
"event"
|
"event" | The kind of object. |
type
string
|
string | One of the event names listed under Webhooks, such as charge.paid. |
details
object
|
object | What changed, for the events that record something extra; see the table below. Empty for the others. |
charge
object|null
|
object|null | The full charge the event is about, without its timeline, or null for invoice events. |
invoice
object|null
|
object|null | The full invoice the event is about, or null for charge events, including those of the invoice's own charges. |
created_at
string
|
string | ISO 8601 timestamp in UTC. |
| Event | details |
|---|---|
charge.payment_detected, charge.late_payment
|
txid and amount of the transfer. |
charge.refunded
|
amount, plus txid and reason when you gave them. |
invoice.sent
|
reminder: true when the email was a reminder. |
invoice.paid
|
charge: the id of the charge that paid it. |
payout.sent, payout.confirmed
|
txid, amount (what was sent) and network_fee of the payout. |
See every event name and what it means
Endpoints
-
GET
/v1/eventsList events, newest first. Filter with ?type=, ?charge= and ?invoice=; ?invoice= finds the invoice's own events, and the events of its charges are found with ?charge=. -
GET
/v1/events/{id}Retrieve one event by its UUID.
Copy failed. Select the code and copy it manually.
curl 'https://api.velirapay.com/v1/events?type=charge.paid&per_page=100' \
--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');
$events = $velirapay->events->list([
'type' => 'charge.paid',
'per_page' => 100,
]);
echo json_encode($events, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR), PHP_EOL;
use VeliraPay\Laravel\Facades\VeliraPay;
$events = VeliraPay::events()->list([
'type' => 'charge.paid',
'per_page' => 100,
]);
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/events?type=charge.paid&per_page=100', {
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 events = response.status === 204 ? null : (await response.json()).data;
console.log(JSON.stringify(events, null, 2));
import json
import os
import requests
api_key = os.environ["VELIRAPAY_API_KEY"]
response = requests.get(
"https://api.velirapay.com/v1/events",
headers={
"Authorization": f"Bearer {api_key}",
"Accept": "application/json",
},
params={
"type": "charge.paid",
"per_page": 100,
},
timeout=(5, 30),
allow_redirects=False,
)
if not 200 <= response.status_code < 300:
raise RuntimeError(f"VeliraPay {response.status_code}: {response.text}")
events = None if response.status_code == 204 else response.json()["data"]
print(json.dumps(events, 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/events?type=charge.paid&per_page=100");
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? events = null;
if (response.StatusCode != HttpStatusCode.NoContent)
{
using var document = JsonDocument.Parse(responseBody);
events = document.RootElement.GetProperty("data").Clone();
}
Console.WriteLine(events?.GetRawText() ?? "null");
Webhooks are still the quickest way to hear about a payment; polling this endpoint every minute or so is the belt and braces behind them. Handle both by event id so a payment handled twice is a no-op.