Laravel Cashier (OrcaRail)
Cashier OrcaRail is a Laravel package that provides a Cashier-style API for OrcaRail stablecoin payments: local subscription state, hosted checkout redirects, and signed webhook sync.
Composer package: orcarail/cashier-orcarail
Namespace: OrcaRail\Cashier
Repository: github.com/OrcaRail/sdks-laravel-cashier
It wraps the official PHP SDK orcarail/orcarail-php.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
Installation
composer require orcarail/cashier-orcarail
php artisan vendor:publish --tag=orcarail-cashier-config
php artisan migrate
Environment
| Variable | Description |
|---|---|
ORCARAIL_API_KEY | API key (ak_…) |
ORCARAIL_API_SECRET | API secret (sk_…) |
ORCARAIL_WEBHOOK_SECRET | Webhook HMAC secret |
ORCARAIL_BASE_URL | Default https://api.orcarail.com/api/v1 |
ORCARAIL_PAY_URL | Default https://pay.orcarail.com |
ORCARAIL_CURRENCY | Default currency code (usd) |
ORCARAIL_WEBHOOK_PATH | Default orcarail/webhook |
Billable trait
use OrcaRail\Cashier\Billable;
class User extends Authenticatable
{
use Billable;
}
Subscriptions
$checkout = $user->newSubscription('default', 'price_xxx')
->trialDays(14)
->create(['payer_email' => $user->email]);
return $checkout; // redirects to latest_payment_link.link when present
Local helpers (backed by the subscriptions table, kept in sync by webhooks):
$user->subscribed()$user->onTrial()$user->subscription()$subscription->cancel()/resume()/pastDue()/paused()
Trials use OrcaRail’s trial_period_days (or trial_end) create parameters.
One-off payments
return $user->checkout('price_xxx', [
'return_url' => url('/orders/return'),
]);
Cashier creates a Payment Intent and, when needed, confirms it to obtain next_action.redirect_to_url.url for the hosted pay page.
Webhooks
Cashier registers POST /orcarail/webhook and verifies the x-webhook-signature header (HMAC-SHA256). Configure that URL on your OrcaRail API key.
Subscription lifecycle events update local rows. Listen to WebhookReceived and WebhookHandled for app-specific side effects.