Accept Crypto in Laravel 10/11 & PHP 8.1+ Apps

Integrate non-custodial multi-chain crypto checkout, SaaS recurring billing, and HMAC-SHA256 webhook middleware into Laravel applications using the official xpayr/xpayr-php Composer SDK and open-source starter repository.

Integration Details

Version 1.0.0
Last Updated 2026-11-11
Compatibility Laravel 10 / 11 Β· PHP 8.1+
Open-Source Repo v1.0.0 Release
Open Laravel Starter Repo

How to integrate XPayr in Laravel

  1. Install the official PHP SDK via Composer: composer require xpayr/xpayr-php
  2. Add XPAYR_SECRET_KEY and XPAYR_WEBHOOK_SECRET to your Laravel .env file
  3. Create checkout sessions in your Controller and exclude /webhooks/xpayr from CSRF middleware
  4. Dispatch Laravel Queue jobs on verified payment.completed webhook events

5-Step Laravel Setup Guide

  1. Run composer require xpayr/xpayr-php in your Laravel project or clone github.com/xpayrcom/xpayr-laravel-example.
  2. Publish XPAYR_SECRET_KEY=sk_test_... and XPAYR_WEBHOOK_SECRET=whsec_... into config/services.php.
  3. Instantiate the XPayr client to create hosted or modal sessions with order_id and customer_id metadata.
  4. Verify raw request payloads with hash_equals(hash_hmac("sha256", $rawBody, $secret), $signatureHeader) inside dedicated webhook middleware.
  5. Issue ES256 software licenses (/developers/license-kit) or unlock SaaS subscriptions idempotently using session_id unique keys.

Why Laravel engineers love XPayr

Zero-bloat PSR PHP SDK

Clean, strictly typed PHP 8.1+ client published on Packagist (xpayr/xpayr-php) and GitHub.

Idempotent HMAC webhooks

Deterministic X-XPayr-Signature headers and event IDs fit cleanly into Laravel Queues and Horizon.

SaaS & License Kit ready

Combine recurring billing schedules (/recurring-billing) with offline-verifiable ES256 JWT entitlements.

AI & Cursor MCP workflow

Scaffold and test Laravel payment controllers directly inside Cursor or Claude Code via @xpayr/mcp-server.

Official Laravel Reference Architecture

Laravel powers tens of thousands of SaaS platforms, digital marketplaces, API products, and B2B portals. XPayr maintains both an official Composer package (xpayr/xpayr-php) and a dedicated open-source reference application (github.com/xpayrcom/xpayr-laravel-example) demonstrating clean controller creation, CSRF-exempt webhook signature verification, idempotent database transitions, and Testnet-to-Mainnet promotion.

FAQ

Laravel SDK & Webhook FAQ

Browse and clone https://github.com/xpayrcom/xpayr-laravel-example alongside https://github.com/xpayrcom/xpayr-php-sdk.

Always compute HMAC-SHA256 against $request->getContent() (the exact raw JSON body) rather than json_encode($request->all()), and exempt your webhook route from VerifyCsrfToken.

Yes. Pair Laravel scheduled jobs or XPayr Recurring Billing webhooks (/recurring-billing) with multi-chain renewal links.

Yes. Use sk_test_ keys plus /tools/webhook-tester or a tunnel to test signed webhook callbacks locally in under 5 minutes.

Ship crypto payments in your Laravel app today.

Clone the starter repo, run composer require xpayr/xpayr-php, and test free on Testnet.