Download the PHP package orkhanahmadov/laravel-goldenpay without Composer

On this page you can find all versions of the php package orkhanahmadov/laravel-goldenpay. 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-goldenpay

:credit_card: GoldenPay package for Laravel

Latest Stable Version Latest Unstable Version Total Downloads GitHub license

Build Status Test Coverage Maintainability Quality Score StyleCI

Full-feature Laravel package for Goldenpay integration.

Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Controller
  5. Models
  6. Commands
  7. Events
  8. Configuration

Requirements

Package PHP Laravel
1.0 ^7.2 5.8.* or ^6.0
2.0 ^7.2 ^6.0 or ^7.0
3.0 ^7.3 or ^8.0 ^8.0

Installation

You can install the package via composer:

Run this command to publish required migration file:

Usage

First, set your Goldenpay merchant name and auth key in .env file. You can get these from Goldenpay Dashboard.

To use Goldenpay service you need instance of Orkhanahmadov\LaravelGoldenpay\Goldenpay. You can instantiate this class using Laravel's service container, for example by injecting to your controller

Or you can use Laravel's service resolver to create instance of the class:

Available methods:

payment()

Prepares payment based on passed credentials and accepts 4 arguments:

Method returns created instance of Orkhanahmadov\LaravelGoldenpay\Models\Payment model.

You can use $payment_url property to get unique payment URL and redirect user to this URL to start payment.

result()

Checks payment result based on previous payment key. Accepts single argument:

Method returns updated instance of Orkhanahmadov\LaravelGoldenpay\Models\Payment model with Goldenpay's response.

Controller

Goldenpay requires to have endpoints for successful and unsuccessful payment. For each of this endpoints Goldenpay sends GET request with payment_key query string attached. To get payment result you need to create a route to accept these requests and fetch result of the payment using received payment_key.

Package ships with a controller that helps to simplify this process. To get started, first create a GET route for successful or unsuccessful payments and add full URL in Goldenpay Dashboard to corresponding field.

Create a controller class for your route and extend Orkhanahmadov\LaravelGoldenpay\Http\Controllers\GoldenpayController.

By extending Orkhanahmadov\LaravelGoldenpay\Http\Controllers\GoldenpayController, your controller will automatically check for payment result based on payment_key query string.

In your controller you can access to $payment property which will have payment results from Goldenpay.

You can use same endpoint for both successful and unsuccessful payments and decide what you want to show user based on $this->payment->successful state or you create separate endpoints and controllers and extend Orkhanahmadov\LaravelGoldenpay\Http\Controllers\GoldenpayController in both controllers.

Models

Package ships with Orkhanahmadov\LaravelGoldenpay\Models\Payment Eloquent model. Model stores following information for each payment:

Besides usual Eloquent functionality this model also has specific accessors, scopes and relationship abilities which you can utilize.

Accessors

Scopes

Relationship

You can make any existing Eloquent model "payable" and attach Goldenpay payments to it. Use Orkhanahmadov\LaravelGoldenpay\Traits\Payable trait in your existing model to establish direct model relationship. Trait usage requires to have amount() description() methods to be defined in your model:

Now Product model has direct relationship with Goldenpay payments. By using Payable your model also gets access to payment related relationships and payment methods.

createPayment()

You can also override amount and description() for specific payment:

Method accepts following arguments:

Method returns created instance of Orkhanahmadov\LaravelGoldenpay\Models\Payment.

payments()

Eloquent relationship method. Return all related payments to model.

successfulPayments()

Eloquent relationship method. Return all related successful payments to model.

Commands

Package ships with artisan command for checking payment results.

Executing above command will loop through all "pending" payments and update their results.

Command also accepts payment key as an argument to check single payment result.

Goldenpay requires manual check for payments to determine their final status. For example, user might go to payment page then close browser window without entering anything. These kind payment cases needs to be checked manually to finalize their status. You can use Laravel's Task Scheduling for running goldenpay:result command on Cron job.

Because Goldenpay states that each payment session is active only for 15 minutes, it is recommended to keep frequency to 5 or 10 minutes.

Events

Package ships with Laravel events which gets fired on specific conditions.

Available event classes:

Each event receives instance of Orkhanahmadov\LaravelGoldenpay\Models\Payment Eloquent model as public $payment property.

You can set up event listeners to trigger when specific payment event gets fired.

Configuration

Run this command to publish package config file:

Config file contains following settings:

If you want to use your own event class for specific payment event you can replace class namespace with your class namespace. Each payment event receives instance of Orkhanahmadov\LaravelGoldenpay\Models\Payment Eloquent model. Because of this, make sure you add payment model as dependency to your event class constructor signature or you can extend Orkhanahmadov\LaravelGoldenpay\Events\PaymentEvent class which already has payment model as dependency.

Setting specific payment event to null disables that event without interrupting others.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

Support me

If you like my work, if my open-source contributions help you or your company, please consider supporting me through Github Sponsors.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-goldenpay with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/contracts Version ^8.0
illuminate/console Version ^8.0
illuminate/database Version ^8.0
illuminate/http Version ^8.0
illuminate/queue Version ^8.0
illuminate/support Version ^8.0
orkhanahmadov/goldenpay Version ^2.2
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 orkhanahmadov/laravel-goldenpay contains the following files

Loading the files please wait ....