Getting started

Libraries

Install a package and skip the plumbing: authentication, retries, pagination and webhook signatures are handled for you.

The libraries wrap the REST API these pages describe. They are open source under the MIT license and install with Composer.

PHP velirapay/velirapay-php

Every endpoint of the API, typed objects, automatic retries and webhook verification, for any PHP application.

PHP 8.1 or later, with any PSR-18 HTTP client

Laravel velirapay/velirapay-laravel

The PHP library set up from your .env, a facade, and webhooks dispatched as Laravel events.

PHP 8.2 or later, with Laravel 12 or 13

PHP

Install it with Composer. It sends requests through the PSR-18 HTTP client your project already has; with none, add Guzzle as well.

composer require velirapay/velirapay-php

Create a client with your API key and send the customer to the charge's checkout page:

use VeliraPay\VeliraPayClient;

$velirapay = new VeliraPayClient('vp_live_…');

$charge = $velirapay->charges->create([
    'amount' => '49.90',
    'currency' => 'EUR',
    'asset' => 'BTC',
    'metadata' => ['order_id' => '1042'],
]);

header('Location: '.$charge->checkoutUrl);

When the webhook arrives, one call checks its signature and reads it:

use VeliraPay\Webhooks\Webhook;

$event = Webhook::constructEvent(
    file_get_contents('php://input'),
    $_SERVER['HTTP_X_VELIRAPAY_SIGNATURE'] ?? null,
    'whsec_…',
);

if ($event->is('charge.paid')) {
    $orderId = $event->charge->metadata['order_id'];
}

A missing, wrong or expired signature throws a SignatureVerificationException: answer with a 400 and stop there.

Laravel

The Laravel package sets up the PHP library for you and receives webhooks on a route of its own.

composer require velirapay/velirapay-laravel

Add your API key and your webhook endpoint's signing secret to .env:

VELIRAPAY_API_KEY=vp_live_…
VELIRAPAY_WEBHOOK_SECRET=whsec_…

Call the API through the facade:

use VeliraPay\Laravel\Facades\VeliraPay;

$charge = VeliraPay::charges()->create([
    'amount' => '49.90',
    'currency' => 'EUR',
    'asset' => 'BTC',
]);

return redirect()->away($charge->checkoutUrl);

Then add https://your-app.example/velirapay/webhook as a webhook endpoint. Each delivery is checked and dispatched as a Laravel event, such as ChargePaid, for your listeners to handle:

use VeliraPay\Laravel\Events\ChargePaid;

class FulfilOrder
{
    public function handle(ChargePaid $event): void
    {
        $orderId = $event->charge->metadata['order_id'];
    }
}

It also comes with helpers to fake API calls and send signed webhooks in your tests.

What they handle

  • Authentication with your API key, whose prefix tells them whether you are in live or test mode.
  • Typed objects for your account, payment links, charges, invoices and events, keeping every field the API sends.
  • An iterator that walks a whole list, fetching each page as it gets there.
  • Retries after network errors, rate limits and outages, with an idempotency key so a retried write is carried out once.
  • An exception for each kind of error, with validation messages keyed by field.
  • Webhook signature checks, including the five-minute limit on a signature's age.

Other languages

There is no library for your language yet? The API is JSON over HTTPS, so any HTTP client can call it. The API reference shows every request and response, and the signature check is spelled out in PHP and Node.js.

Start with authentication →