Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ucashpay-laravel

A Laravel package for U.CASH Pay: create crypto + card checkouts and receive verified settlement webhooks. Non-custodial.

Install

composer require ucash/ucashpay-laravel
php artisan vendor:publish --tag=ucashpay-config

Set your store credentials in .env:

UCASH_CLOUD_TOKEN=st_your_store_cloud_token
UCASH_WEBHOOK_SECRET=your_store_webhook_secret
UCASH_BASE_URL=https://pay.u.cash

Create a checkout

use UdotCASH\UcashPay\Facades\UcashPay;

$r = UcashPay::createCheckout(
    amount: '10.00',
    currency: 'USD',
    external_reference: $order->id,   // idempotent; returned in the webhook
    title: 'Order #' . $order->id,
    redirect_url: route('orders.thanks', $order),
);

if ($r['ok']) {
    return redirect($r['payment_url']);   // send the buyer to hosted checkout
}

Receive payments (webhook)

The package mounts POST /ucashpay/webhook that verifies the X-Webhook-Signature (HMAC-SHA256 over t.raw_body, 300s window, timing-safe) and fires a PaymentReceived event. Listen for it:

// app/Providers/EventServiceProvider.php
protected $listen = [
    \UdotCASH\UcashPay\Events\PaymentReceived::class => [
        \App\Listeners\MarkOrderPaid::class,
    ],
];

Set the webhook URL in pay.u.cash to https://your-app.test/ucashpay/webhook, save, then Test Webhook.

Set up your pay.u.cash account

  1. Sign up at pay.u.cash with email + password, then click the verification link in the email.
  2. Set your receive addresses under Settings → Addresses (a wallet per coin, or ENS/Unstoppable/FIO names). Crypto settles here.
  3. Create a store at Account → Stores → + Add Store.
  4. Copy the Store Cloud Token + Store Webhook Secret into your .env. Use the store-level token, not the account-wide one.
  5. Set the webhook URL as above, then Test Webhook.

Test connection

app('ucashpay')->testConnection('https://your-app.test/ucashpay/webhook');

License

MIT.

About

U.CASH Pay for Laravel: create crypto + card checkouts and receive verified settlement webhooks. Non-custodial.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages