antony-sklyar/laravel-payments

Package that provides a handy simple facade to various online payment services.

This package's canonical repository appears to be gone and the package has been frozen as a result.

v0.3.4 2018-03-21 10:05 UTC

This package is not auto-updated.

Last update: 2019-01-21 13:09:52 UTC


README

This package provides Payment facade that gives a developer two instruments that are common for any online payment provider:

  • getPaymentRequest() returns the HTTP request that is needed to perform the payment (url, method and parameters) for a provided order;
  • getPaymentStatus() returns status of the payment of the provided order.

Various online payment providers are implemented as drivers behind the Payment facade (same pattern as in Storage or DB built-in Laravel facades). Following payment methods are implemented at the moment:

"Cash" is a pseudo payment service that is meant to be used if you allow your admins to manually receive payments from the clients, thus creation and update of invoices happens on your admin panel without going to any payment service provider at all.

To perform a payment you implement a form in your Blade view like so (assuming that request variable contains result of Payment::getPaymentRequest() method):

<form action="{{ $request->url }}" method="{{ $request->method }}">
    @foreach ($request->parameters as $name => $value)
      <input type="hidden" name="{{ $name }}" value="{{ $value }}">
    @endforeach
    <button type="submit">Go To Payment Service</button>
</form>