Download the PHP package islam016/laravel-safe-checkout without Composer

On this page you can find all versions of the php package islam016/laravel-safe-checkout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-safe-checkout

Laravel Safe Checkout

tests PHP Laravel License

Payments for Laravel with Moyasar and Tap that are hard to get wrong.

Calling a payment API is the easy part. The bugs that cost money live around it:

What goes wrong What this package does
The customer double-clicks "Pay", or a request is retried, and two checkouts are opened Checkout::start() takes an idempotency key. The same key returns the same payment and the same checkout page. A unique index protects against races.
Someone posts a fake "paid" webhook to your endpoint Webhooks are verified (Moyasar secret token, Tap HMAC-SHA256 hashstring) and rejected with 403 otherwise.
The webhook body is trusted for the status or the amount The payload is only used to find the payment. Status and amount are always fetched from the gateway API.
A payment for 1 SAR is accepted for a 1,500 SAR order The amount and currency the gateway reports must match the order exactly, or the payment is failed with amount_mismatch.
The gateway delivers the same webhook 3 times and the order is fulfilled 3 times Each delivery is recorded once. PaymentSucceeded fires exactly once.
A late or out-of-order webhook turns a paid order back into failed A state machine makes paid and expired final.
Your server or the gateway API was down when the webhook came On gateway errors the webhook returns 503 so it is retried, and safe-checkout:reconcile catches anything that was missed.
0.1 + 0.2 and float rounding Money is stored as an integer in halalas (or fils for KWD/BHD/OMR, with 3 decimals).

Installation

Point the gateway's webhook to:

To change the prefix, middleware or table names: php artisan vendor:publish --tag=safe-checkout-config.

Usage

1. Start a checkout

Tap needs a customer:

2. Fulfil the order when, and only when, it is really paid

3. On the page the customer returns to

The redirect itself proves nothing, so confirm with the gateway:

4. Safety net for missed webhooks

Queue mode

Set CHECKOUT_QUEUE=true to answer webhooks immediately and reconcile in a queued job (5 tries with backoff).

How a payment moves

Adding another gateway

Implement IslamGaber\SafeCheckout\Contracts\Gateway (createCheckout, fetch, parseWebhook) and add a gateways.hyperpay entry with 'driver' => 'hyperpay' to the config. Everything else (idempotency, verification flow, amount checks, state machine, events) comes for free.

Testing

Every flow above has a test with faked gateway responses: double clicks, forged and tampered webhooks, replayed deliveries, wrong amounts, stale responses, gateway outages and missed webhooks. CI runs on PHP 8.2–8.4 with SQLite, and on real MySQL 8.4 and PostgreSQL 17.

Notes

License

MIT © Islam Gaber


All versions of laravel-safe-checkout with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^12.0
illuminate/database Version ^12.0
illuminate/http Version ^12.0
illuminate/queue Version ^12.0
illuminate/routing Version ^12.0
illuminate/support Version ^12.0
guzzlehttp/guzzle Version ^7.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package islam016/laravel-safe-checkout contains the following files

Loading the files please wait ...