Download the PHP package pumuklisk8/barion-web-php without Composer

On this page you can find all versions of the php package pumuklisk8/barion-web-php. 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 barion-web-php

BarionPHP

BarionPHP is a compact PHP library to manage online e-money and card payments via the Barion Smart Gateway. It allows you to accept credit card and e-money payments in just a few lines of code.

BarionPHP lets you

All with just a few simple pieces of code!

Version history

For details about version changes, please refer to the changelog.txt file.

System requirements

Installation

Copy the contents of the barion library into the desired folder. Be sure to have access to the path when running your PHP script.

Basic usage

Include the BarionClient class in your PHP script:

Then instantiate a Barion client. To achieve this, you must supply three parameters.

First, the secret key of the online store registered in Barion (called POSKey)

The API version number (2 by default)

The environment to connect to. This can be the test system, or the production environment.

With these parameters you can create an instance of the BarionClient class:

Examples

Starting an online payment

Let's see a basic example of using the Barion library. We are going to start an immediate online payment, where the user can pay for one product which costs 1 000 HUF.

1. Creating the request object

To start an online payment, you have to create one or more Payment Transaction objects, add transaction Items to them, then group these transactions together in a Payment object.

First, create an ItemModel:

Then create a PaymentTransactionModel and add the Item mentioned above to it:

Finally, create a PreparePaymentRequestModel and add the PaymentTransactionModel mentioned above to it:

At this point, the complete request object looks like this:

Note: the secret POSKey used for authentication is not part of the request object. The Barion client class automatically injects this value into every request sent to the Barion API.

2. Calling the Barion API

Now you can call the PreparePayment method of the Barion client with the request model you just created:

The Barion API now prepares a payment entity that can be paid by anyone.

The $myPayment variable holds the response received from the Barion API, which is an instance of a PreparePaymentResponseModel object. It should look something like this:

The RequestSuccessful parameter shows that the request was successfully made. PaymentId holds the public identifier of the payment you just created in the Barion system, and the Transactions array contains the transactions related to this payment. The fist element is the transaction you constructed before, and the other two are fee transactions generated by the Barion Smart Gateway. In this case, these are gateway usage and bank card processing fees.

Note: The amount and types of the related fee transactions depend on the request caller identity - please refer to the documentation at https://docs.barion.com or contact our Sales Department.

3. Redirecting the user to the Barion Smart Gateway

You can use the PaymentId value in the response to redirect the user to the Barion Smart Gateway. You have to supply this identifier in the Id query string parameter. The complete redirect URL looks like this:

The user can now complete the payment at the Barion Smart Gateway.

Getting information about a payment

In this example we are going to get detailed information about the payment we just created above.

1. Creating the request object

To request details about a payment, you only need one parameter: the payment identifier. This is the PaymentId we have used earlier to redirect the user.

2. Calling the Barion API

To request payment details, we call the GetPaymentState method of the Barion client class with the identifier above:

The $paymentDetails variable holds the response received from the Barion API, which is an instance of a PaymentStateResponseModel object. It should look something like this:

The payment is in Prepared status, which means it is still waiting to be paid. If we wait until the user completes the payment, and send the request again, we should get a slightly different result with more information:

As you can see, the payment status is now Succeeded, which means the payment has been completed successfully. The FundingSource paramter shows that the payment was completed using a bank card. Also, the Payer parameter of the first transaction shows that the payment was completed by the John Doe ([email protected]) user account.

Further examples

To view more examples about the usage of the Barion library, refer to the example files found in the Samples folder of the repository.

© 2015 Barion Payment Inc.


All versions of barion-web-php with dependencies

PHP Build Version
Package Version
No informations.
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 pumuklisk8/barion-web-php contains the following files

Loading the files please wait ....