Download the PHP package fei/payment-client without Composer

On this page you can find all versions of the php package fei/payment-client. 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 payment-client

Payment Client

You can use this client to consume the Payment service.

With this client you can use two kind of transports to send the requests :

BeanstalkProxyTransport delegates the API consumption to workers by sending payments entities to a Beanstalkd queue.

BasicTransport uses the classic HTTP layer to send payments synchronously.

You can find examples of how to use payment client methods in the examples folder.

Installation

Payer client needs at least PHP 5.5 to work properly.

Add this requirement to your composer.json: "fei/payment-client": : "^1.0"

Or execute composer.phar require fei/payment-client in your terminal.

If you want use the asynchronous functionality of the Payer client (and we know you want), you need an instance of Beanstalkd which running properly and an instance of api-client-worker.php which will consume the Beanstalk's pipe and forward messages payload to the Payment API:

Beanstalkd configuration

Running Beanstalkd is very simple. However, you must pay attention to the z option which set the maximum job (or message) size in bytes.

Run api-client-worker.php

You could see below an example of running api-client-worker.php:

Options Shortcut Description Default
host -h The host of Beanstalkd instance localhost
port -p The port which Beanstalkd instance listening 11300
delay -d The delay between two treatment of the worker 3 seconds
verbose -v Print verbose information -

You can control the api-client-worker.php process by using Supervisor.

Entities and classes

Payment entity

In addition to traditional id and createdAt fields, Payment entity has eleven important properties:

Properties Type
id integer
uuid string
createdAt datetime
payedAt datetime
expirationDate datetime
status integer
cancellationReason string
requiredPrice float
capturedPrice float
authorizedPayment integer
selectedPayment integer
contexts ArrayCollection
callbackUrl ArrayCollection
orderId string
paymentMethod string

Context entity

In addition to traditional id field, Context entity has three important properties:

Properties Type
id integer
key string
value string
payment Payment

Basic usage

In order to consume Payer methods, you have to define a new Payer instance and set the right transport (Asynchronously or Synchronously).

Payer client instance will first attempt to transfer the messages with Beanstalkd, if the process fail then the client will try to send Payment payload directly to the right API endpoint.

There are several methods in Payer class, all listed in the following table:

Method Parameters Return
request Payment $payment integer
update Payment $payment integer
retrieve int $paymentId Payment
search SearchBuilder $search array
cancel Payment|int $payment, int $reason intger
reject Payment|int $payment, int $reason intger
capture Payment|int $payment, float $amount intger
refund Payment|int $payment, float $amount intger
getPaymentLink Payment|int|string $payment string

Client option

Only one option is available which can be passed either by the constructor or by calling the setOptions method Payer::setOptions(array $options):

Option Description Type Possible Values Default
OPTION_BASEURL This is the server to which send the requests. string Any URL, including protocol but excluding path -

Note: All the examples below are also available in the examples directory.

Request

You can create new Payment by using the request() method of the Payer client:

Example

Update

You can update an existing Payment by using the update() method of the Payer client:

Example

Retrieve

You can retrieve one Payment by using the retrieve() method of the Payer client that takes one parameter: the id the the payment entity OR the uuid of the payment.

Example

Search

You can search for payments by using the search() method of the Payer client that takes a SearchBuilder instance.

Example

Cancel

You can cancel one payment by using the cancel() method of the Payer client that takes a Payment instance (or id) and a string for the reason of the cancellation.

Example

Reject

You can reject one payment by using the reject() method of the Payer client that takes a Payment instance (or id) and a string for the reason of the cancellation.

Example

Capture

You can capture one payment by using the capture() method of the Payer client that takes a Payment instance (or id) and a float for the amount to capture.

Example

GetPaymentLink

You can get the public payment link to process a payment by using the getPaymentLink() method of the Payer client that takes either a Payment instance or an id or an uuid.

Example


All versions of payment-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
fei/api-client Version ^1.1
fei/payment-common Version ^2.6.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 fei/payment-client contains the following files

Loading the files please wait ....