How to add payments to a Laravel app
To add payments to a Laravel app, install Ruba’s PHP SDK with Composer, create a Checkout Session from a controller, redirect the buyer to the session URL, and confirm the sale with a verified webhook. Ruba is the Merchant of Record, so you need no Stripe account and no company. Ruba pays you to your own bank.
The plan
Nabeel in Sialkot runs a Laravel app that generates quotation PDFs. He wants to charge $12 a month. Stripe does not support Pakistan, so he looks for another way. Ruba has a PHP SDK that supports Laravel auto-discovery, according to its docs.
- Step 1Install the SDKPHP 8.2 or newer.
- Step 2Create a sessionIn a controller.
- Step 3Redirect the buyerTo the session URL.
- Step 4Confirm by webhookVerified, then unlock.
Install
The SDK requires PHP 8.2 or newer and supports Laravel auto-discovery. Create an access token in the sandbox dashboard first, and keep it in your environment file, not in your code.
composer require getruba/sdkSend the buyer to checkout
A checkout session is a short-lived buying flow your server creates just before the buyer pays. Pass the product ID, a success URL and, if you have it, your own customer ID as the external customer ID. Redirect to the URL Ruba returns.
<?php
namespace App\Http\Controllers;
use Ruba\Models\Components\CheckoutCreate;
class CheckoutController extends Controller
{
public function __invoke()
{
$sdk = \Ruba\Ruba::builder()
->setServer('sandbox') // remove for production
->setSecurity(config('services.ruba.token'))
->build();
$response = $sdk->checkouts->create(new CheckoutCreate(
products: [config('services.ruba.product_id')],
successUrl: route('thanks'),
externalCustomerId: (string) auth()->id(),
));
return redirect()->away($response->checkout->url);
}
}Create the session when the buyer clicks, not in advance. The session URL is temporary.
Confirm with a webhook
Never unlock features only because the browser reached your success page. Ruba sends webhooks that follow the Standard Webhooks specification. Verify the signature using the raw request body and your endpoint’s signing secret, then queue the work and return a 2xx quickly.
- 1Public https routeNot localhost.
- 2Skip login and CSRF checksFor this one route.
- 3Read the raw bodyBefore any parsing.
- 4Queue a jobThen return 2xx.
- 1Signed requestStandard Webhooks headers.
- 2RetriesUp to 10, with backoff.
- 3Events in orderPer endpoint.
- 4Kept 90 daysYou can redeliver.
Details are in how to handle Ruba webhooks.
Before you go live
See the early-access deal. Ruba charges 4% + $0.50 per sale, plus 0.5% on subscriptions, with no monthly fee.
Ruba has a PHP SDK, so it fits. Nothing monthly to pay, and no company required. Approved during early access? Then 4% + $0.50 per sale is locked for your Laravel app while the account stays open and in good standing. If Ruba charges a fee it never told you about, it refunds it and pays you $100. Terms apply. See the early-access deal.
Questions people ask
Does Ruba have a PHP SDK?
Yes. Ruba has a PHP SDK that needs PHP 8.2 or newer, installs with composer require getruba/sdk, and supports Laravel auto-discovery. It follows a builder pattern and can point at the sandbox.
How do I start a checkout from Laravel?
Create a Checkout Session from your server with the product ID, then redirect the buyer to the returned url. The session URL is short-lived, so create it when the buyer clicks.
How do I know a payment succeeded?
Use a success redirect for the buyer’s page, and a webhook for your records. Verify the webhook signature, and do not unlock anything from the browser alone.
Do I need Stripe in Laravel?
No. Your Laravel app talks to Ruba, which is the Merchant of Record and pays you to your own bank.
How do I test?
Use Ruba’s sandbox: a separate environment with its own dashboard, API and checkout. Set the server to sandbox in the SDK, and use a sandbox access token.
Sources
We check these when we update this guide. Rules can change, so check them yourself before you decide.
- Ruba: PHP SDKChecked 26 Nov 2026
- Ruba: checkout sessionsChecked 26 Nov 2026
- Ruba: webhook deliveryChecked 26 Nov 2026
- Ruba: sandboxChecked 26 Nov 2026
- Ruba: pricing and feesChecked 26 Nov 2026