Download the PHP package gifddo/client without Composer
On this page you can find all versions of the php package gifddo/client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gifddo/client
More information about gifddo/client
Files in gifddo/client
Informations about the package client
Gifddo PHP Client
Gifddo payment service integration library.
Prerequisites
To get started with Gifddo integration, you will need to generate a key pair. You can do that using the openssl
command line tool:
These commands will generate the keys in the required (PEM) format. Save the files somewhere in your project folder.
You will then have to contact Gifddo and request a merchant account (in either live or testing environment). Make sure to send them the public key you just generated above. In response, you should receive a merchant ID, which you'll need when initializing the library.
Usage
Install the library in your project via Composer:
Initialize the client by instantiating the class:
Create and sign payment request parameters:
Perform the request:
Note: instead of having the backend make the API request for you, you may want to perform it directly on the frontend. You can do so by returning the parameters you received in the
initiate
call above to the browser, along with the Gifddo API endpoint URL, which you can obtain by calling$client->getUrl()
:On the frontend side, you can then populate a hidden form with the fields listed in
params
, and post it to theurl
. Gifddo will automatically redirect the browser to the payment page.
The user then makes the payment on the Gifddo site (at the redirected or returned URL). When the process is complete, the user is redirected to the return_url
provided in the initiate
method call. Additionally, the provided URL also receives a payment status update directly from Gifddo, with the same data, except for the VK_AUTO
request parameter, which is set to Y
in case of automatic status update, and N
for client browser request. You should make sure to check the value of that parameter when deciding whether to redirect the user (or display a success/fail message, or anything else based on the specific needs of your application).
Verify the payment status message on the return_url
(and cancel_url
, if you set a different one for that) endpoint as follows:
Modify the above code according to your needs. You can omit the switch
block in case you set different return_url
and cancel_url
.
License
Copyright (c) 2020-Present Gifddo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.