payracash / payra-sdk-laravel
Payra Crypto Payments signature generator SDK for Laravel
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/payracash/payra-sdk-laravel
Requires
- php: ^8.0
- simplito/elliptic-php: ^1.0
- web3p/web3.php: ^0.3.2
README
Official Laravel SDK for integrating Payra's on-chain payment system into your backend. Provides a simple way to generate secure ECDSA signatures compatible with the Payra smart contract (e.g. for payment verification).
Features
- Ethereum ECDSA signature generation using the
secp256k1
curve - Fully compatible with Payra's Solidity contracts (ERC-1155 payment verification)
- Built-in ABI encoding via
web3.php
- Multi-network support via
.env
andconfig/payra.php
- Laravel IoC container integration (easy dependency injection)
Setup
Before installing this package, make sure you have an active Payra account:
You will need your merchantID and a dedicated account (private key) to generate valid payment signatures.
Requirements
- Laravel 8+
- PHP 8.0+
- Payra account with
merchantId
andprivateKey
for the selected network
Installation
Via Composer (recommended)
composer require payracash/payra-sdk-laravel
Laravel will auto-discover the service provider.
You can also publish the configuration file:
php artisan vendor:publish --tag=payra-config
Environment Setup
In your .env
file, set the credentials for the networks you plan to use:
PAYRA_POLYGON_PRIVATE_KEY=your_private_key_here
PAYRA_POLYGON_MERCHANT_ID=your_merchant_id_here
PAYRA_ETHEREUM_PRIVATE_KEY=
PAYRA_ETHEREUM_MERCHANT_ID=
PAYRA_LINEA_PRIVATE_KEY=
PAYRA_LINEA_MERCHANT_ID=
These values will be loaded into config/payra.php
.
Usage Example
use Payra\Laravel\PayraSignatureGenerator;
class PaymentController extends Controller
{
public function sign()
{
$generator = app(PayraSignatureGenerator::class);
$signature = $generator->generateSignature(
$network, // e.g. "polygon"
$tokenAddress, // ERC-20 USDT or USDC
$orderId, // string (unique per merchantId)
$amount, // in Wei $1 = 1_000_000
(int) $timestamp,
$payerAddress // Public payer wallet address
);
return response()->json(['signature' => $signature]);
}
}
You can also inject the generator via constructor:
public function __construct(private PayraSignatureGenerator $payra) {}
public function signOrder()
{
return $this->payra->generateSignature(...);
}
Security Notice
- Never expose your
privateKey
in frontend code or public repositories - This SDK is server-side only
- Consider using Laravel's configuration caching or a secrets manager for sensitive keys
Project
Social Media
License
MIT © Payra