pecunia-wallet/pecunia-sdk-php

Pecunia Wallet PHP SDK

Maintainers

Package info

github.com/Pecunia-Wallet/pecunia-sdk-php

Homepage

Issues

pkg:composer/pecunia-wallet/pecunia-sdk-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-03-18 13:08 UTC

This package is auto-updated.

Last update: 2026-03-18 13:12:24 UTC


README

Packagist Version License PHP Version

This SDK provides an easy way to interact with Pecunia Wallet REST API. Consult it for rich details.

Installation

Install via Composer:

$ composer require pecunia-wallet/pecunia-sdk-php

Usage

require 'vendor/autoload.php';

// Initialize client
$client = new \Pecunia\Client('your-api-token-here');

// Get all invoices
$invoices = $client->getAllInvoices();
foreach ($invoices as $invoice) {
    echo "Invoice ID: {$invoice->id}, Requested Amount: {$invoice->amount->requested}\n";
}

// Create new invoice
$newInvoiceRef = $client->createInvoice([
    'amount' => '10',
    'sourceCurrency' => 'USD',
    'lifeTime' => 'PT1H', // 1 hour
    'availableCoins' => ['BTC', 'LTC']
]);

// Invoice details
$invoiceDetails = $client->getInvoice($newInvoiceRef->id);

// Get a payment link for the user
$paymentUrl = $newInvoiceRef->paymentUrl; // or $invoiceDetails->paymentUrl

// Verify callback signature
$payload = "request-body";              // Raw callback body
$header = "request-x-signature-header"; // X-Signature header
$secret = "your-callback-secret-here";  // Your callback secret

$ver = \Pecunia\Callback::verifySignature(
    $payload,
    $header,
    currentSecret: $secret,
    previousSecret: $secret // Previous secret is optional but supported for rotation
);

if ($ver) {
    echo "Verified signature with " . ($ver == 'v0' ? 'previous' : 'current') . "secret";
} else {
    echo "Failed to verify the signature.\n";
}