Download the PHP package creagia/laravel-redsys without Composer

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

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Introduction

Integrate your Laravel application with Redsys, the lead payment gateway in Spain.

This package provides:

You'll be able to create a payment request, redirect the user to the payment gateway and process Redsys response with just a few lines of code:

If you are not using Laravel, check our other package creagia/redsys-php for just a Redsys PHP library.

Support us

Laradir banner

Installation

You can install the package via composer:

After that, you should publish and run the migrations:

Next, you should publish the config file with:

Finally, you should define, at least, the required options in your .env file:

This is the content of the published config file:

Usage

Introduction

This packages integrates redsys-php with your Laravel application. You can use it in two different ways:

Associate requests with Eloquent models

Add the CanCreateRedsysRequests trait and implement the RedsysPayable class to the model you would like make payable.

Typically, this model would be something like Order for a full ecommerce or cart system, but you can associate payments with multiple Eloquent models if you prefer it.

You should implement your getTotalAmount and paidWithRedsys methods. The first one will return the computed total amount for the payment in cents. The second will be executed when Redsys confirms the payment was successful.

Create request:

Custom Redsys requests

If you prefer to not associate a Redsys request to an Eloquent model, or you need to create a more complex request, you can create a custom request easily.

This way you can totally customize the request and implement every Redsys feature available. The request input parameters are defined with a RequestParameters object that implements all the available parameters

The RequestBuilder has some middle methods to help you create your requests. You can associate your custom request with an eloquent model using the associateWithModel() method and interact with credit card tokens with requestingCardToken() or usingCardToken() methods. Check the Credential-On-File requests section to know more about it.

After creating the request you should continue on the next section to send the request to Redsys.

Sending requests to Redsys

From all the integration methods available on Redsys, you can implement 'Redirection' and 'REST' methods.

Once you created your Redsys request, you should send it either with redirection:

or send it as a POST request:

Keep in mind that the REST integration mode is not available for all features and is not always enabled by default. Always check the Redsys documentation and your account configuration if you are not sure if you can use it or something is not working.

Redsys response

Redsys notification with the request result will be automatically managed by the package. For successful payments, the package will run the paidWithRedsys method from your model.

Redirect users back

In the redirection method, when the client has finished, Redsys will redirect they to your website. By default, this package serves a successful or unsuccessful route with a pretty simple view. You can override redirect routes on the config file:

Credential-On-File (token) requests

Credential-On-File requests uses authorized stored card data to create future requests after an initial one. This is useful for a few use cases like subscriptions with recurring payments or installments for individual payments.

While you can create Credential-On-File with a custom Redsys request as defined on Redsys documentation, this packages provides some helpers to make it easier.

Credential-On-File transactions require an initial request where you ask for a card token. After that, you can create new requests with the card token stored on your application.

Prepare your Eloquent model

Use the InteractsWithRedsysCards concern on the model you want to associate with Redsys card tokens. Typically this model will be User, Team or Subscription, for example.

Initial request

Future requests

Local Gateway

LaravelRedsys provides a practical local gateway to test your app locally without need to expose it. When your environment config is defined to local, your Redsys payments will redirect to your local app instead of the test or production Redsys url.

You'll be able to test authorised and denied payments selected the response code between the available options.

For your security, this feature is only available if your app is set to local environment too, apart from the package config.

Unsuccessful or abandoned payments

Unsuccessful payments won't execute any method, unlike the successful ones.

Users can abandon the payment on the Redsys side, and we wouldn't get notified on that. Because of that, you should take care of pending/cancelled/abandoned payments on your application.

Events

The package will fire some events you can listen to:

RedsysNotificationEvent

This event is fired when Redsys tries to notify you with a result from a payment. This event doesn't contain the RedsysPayment model because it's fired before processing the request.

The event has one property with the request inputs from Redsys: $fields.

RedsysSuccessfulEvent

This event is fired when a successful notification from Redsys is processed.

The event has two properties:

RedsysUnsuccessfulEvent

This event is fired when an unsuccessful notification from Redsys is processed.

The event has two properties:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-redsys with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
creagia/redsys-php Version ^2.0
illuminate/contracts Version ^8.73|^9.0|^10.0
spatie/data-transfer-object Version ^3.7
spatie/laravel-package-tools Version ^1.9.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 creagia/laravel-redsys contains the following files

Loading the files please wait ....