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

On this page you can find all versions of the php package pyr0hu/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:

If you're having problems with the SSL connection then you can set the fourth parameter to true: $useBundledRootCerts This will use the bundled root certificate list instead of the server provided one.

Base flow

Using the library, managing a payment process consists of two steps:

1. Starting the payment

1.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:

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.

1.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.

1.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.

2. Getting information about a payment

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

2.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.2. Calling the Barion API

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

Based on the payment status and parameters received in the response, the shop can now decide whether the payment was successful or not.

Basic troubleshooting

Here are a few common mistakes you might want to double check for before reaching out to our support:

1. I get a "User authentication failed" error when sending my request

2. I get a "Shop is closed" error message in the TEST environment

Further examples

To view more examples about the usage of the Barion library, refer to the docs and examples folders of the repository.

© 2017 Barion Payment Inc.


All versions of barion-web-php with dependencies

PHP Build Version
Package Version
Requires ext-curl Version *
php Version >=7.3
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 pyr0hu/barion-web-php contains the following files

Loading the files please wait ....