Download the PHP package onepay/laravel-checkout without Composer
On this page you can find all versions of the php package onepay/laravel-checkout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-checkout
Laravel · OnePay · Checkout Link API
OnePay Checkout for Laravel
Server-side Laravel integration for the OnePay Checkout Link API (api.onepay.lk) — create payment links with correct SHA-256 hashing, validation, and structured error handling.
Getting started
The steps below work with Laravel 10.x, 11.x, and 12.x (PHP 8.1+).
Laravel auto-discovers the package: you do not need to register the service provider manually unless you disabled discovery.
Install
Install the package with Composer:
Configure
Publish the configuration file:
This creates config/onepay.php. Set your server-side only secrets in .env (never expose these in frontend or mobile apps):
The API base URL is fixed in config/onepay.php (https://api.onepay.lk/v3) and is not read from .env, so it cannot be overridden from client input.
Usage
Dependency injection (recommended)
Inject OnePay\Checkout\Services\OnePayService into your controller or action:
Facade
Request fields
| Field | Required | Description |
|---|---|---|
reference |
Yes | Unique transaction reference (10–64 characters). Use your order id or generateReference(). |
amount |
Yes | Amount; normalised to 2 decimals for hashing and the API. |
customer_first_name |
Yes | |
customer_last_name |
Yes | |
customer_phone_number |
Yes | |
customer_email |
Yes | |
transaction_redirect_url |
Yes | Return URL after payment. |
currency |
Yes | Exactly 3 characters (e.g. LKR). Often config('onepay.currency'). |
additionalData |
No | Any extra string metadata for the transaction (API key: additionalData). |
items |
No | Array of created item ids (numeric ids are sent as strings in JSON). |
Response object
createCheckoutLink() returns OnePay\Checkout\DTOs\CheckoutResponse:
| Property / method | Description |
|---|---|
reference |
Same reference you passed in (echo from your payload) |
hash |
SHA-256 sent to the API |
redirectUrl |
Gateway URL to send the customer to |
rawResponse |
Decoded JSON from OnePay |
succeeded() |
Helper for success-style payloads |
toArray() |
Array for JSON APIs |
Hash rules (OnePay requirement)
The package normalises amount to two decimal places and builds:
sha256(app_id + currency + amount + hash_salt) → lowercase hex.
Laravel version compatibility
| Laravel | PHP | Package status |
|---|---|---|
| 12.x | ≥ 8.1 | Supported |
| 11.x | ≥ 8.1 | Supported |
| 10.x | ≥ 8.1 | Supported |
| 9.x | — | Not supported |
Security
- Keep
ONEPAY_APP_TOKENandONEPAY_HASH_SALTonly on the server. - Validate and allowlist
transaction_redirect_urlif it can be influenced by end users (open-redirect risk). - Confirm paid orders using OnePay’s official callback / status flows — this package covers checkout link creation only.
License
This package is open-sourced software licensed under the MIT license.
Links
- Packagist —
onepay/laravel-checkout - OnePay API base:
https://api.onepay.lk/v3/checkout/link/
All versions of laravel-checkout with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0