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.

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-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.

Latest Stable Version Total Downloads Monthly Downloads


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


License

This package is open-sourced software licensed under the MIT license.


Links


All versions of laravel-checkout with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
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 onepay/laravel-checkout contains the following files

Loading the files please wait ...