Download the PHP package barzahlen/barzahlen-php without Composer
On this page you can find all versions of the php package barzahlen/barzahlen-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download barzahlen/barzahlen-php
More information about barzahlen/barzahlen-php
Files in barzahlen/barzahlen-php
Package barzahlen-php
Short Description Barzahlen PHP Library
License MIT
Homepage https://www.viafintech.com
Informations about the package barzahlen-php
viacash/Barzahlen Payment Module PHP SDK (v2.2.0)
Copyright
(c) 2016-2024, viafintech GmbH
https://www.viafintech.com
Preparation
API Credentials
The API credentials, which are necessary to use the Barzahlen API, can be received at Barzahlen Control Center. After a successful registration a division ID is assigned to you as well as a payment key.
Installation
The Barzahlen PHP SDK can be installed using Composer.
Client
The client will connect your application to the Barzahlen API v2. Initiate it with the division ID and the payment key. Set the third, optional parameter to true if you want to send your requests to the sandbox for development purpose. Optional: Set a custom user agent.
It's recommended to surround API calls with try-catch-blocks since errors are thrown as exceptions. This way they can be logged as required by the system.
The API will send you JSON as response. Use json_decode() to transform it into an object or an associative array.
Requests
There are five different requests which the client can handle for you. The required and optional parameters can be set using setters, an array or you can use a JSON string.
CreateRequest
To request a new payment or refund slip simply initiate a new CreateRequest and add the parameters. Here are three examples for a minimal payment request using setters, an array and plain json.
Payment Slips
Refund Slips
This is an example for a minimal refund request. Please note that the amount is negative and must not exceed the initial payment amount. Multiple refunds for one payment up to the initial amount are possible.
Payout Slips
This is an example for a minimal payout request.
Payout slips allow a customer to receive money and result in money being transferred from your division. They are used when paying out money that is not associated with a previous payment. When returning a portion or all of the money a customer has previously paid via Barzahlen, use refund slips.
More parameters
You may set more parameters according to the Barzahlen API v2 Documentation.
The customer data can be set as array and the expiresAt value can be a DateTime object. Also, you can use chaining with the setters.
Example Response
Representation of current slip status. (Content depends on sent parameters.)
UpdateRequest
To change slip parameters afterwards initiate a new UpdateRequest using the slip id. Use setters, an array or a json string to set your new or updated parameter(s). Only pending slips can be updated. For more information please read the Barzahlen API v2 Documentation.
The expiresAt() method can be used with a DateTime object and chaining the setters is also possible. The response will contain a json with updated information.
RetrieveRequest, ResendRequest, InvalidateRequest
The last three requests don't require any additional parameters via setters, array or json. They can be initiate with the slip id (and message type) before they're sent with the client.
RetrievePdfRequest
Retrieve the slip’s PDF representation for printing. Downloading the PDF is only possible for slips in the pending state.
Note: Due to security reasons this endpoint is disabled by default and can only be enabled by Barzahlen. Please feel free to contact us if you are interested in using this feature.
Webhook
When the state of a slip changes (e.g. the customer payed at a retail partner) and a hook url is set, Barzahlen will send a POST request to this hook url to let you know about the change. Initiate the Webhook class with the payment key and use it to verify the incoming request's header and body.
Support
The viacash Team will happily assist you with any problems or questions.
Send us an email to [email protected] or check out our Solutions center at https://www.viafintech.com/overview-solutions/.
All versions of barzahlen-php with dependencies
ext-mbstring Version *