Download the PHP package rwbuild/guhemba-web-element without Composer
On this page you can find all versions of the php package rwbuild/guhemba-web-element. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rwbuild/guhemba-web-element
More information about rwbuild/guhemba-web-element
Files in rwbuild/guhemba-web-element
Package guhemba-web-element
Short Description A laravel-php package that facilitates the integration of guhemba payment in your application
License MIT
Informations about the package guhemba-web-element
Guhemba payment package
A laravel-php package that facilitates the integration of guhemba payment api in your application
Official Documentation
From the version >=3.0.0
, You can find the official documentation here
OLD VERSIONS DOCUMENTATION(<=v2.1.2)
At this page you will see the documentation of this package form v0 - v2.1.2
1. Prerequisite
- laravel framework
2. Installation
3. Configuration
3.1 Publish config file
This configuration concerns systems that use a single merchant wallet for receiving payment,
In order to start enjoying the package, you will need to publish the config file that support Guhemba
After running this command you should see a guhemba-webelement
file under the directory config
, then you will need to provide all information required in that file.
3.2 Configuration for close partners
If you don't have a guhemba partner key, then you should skip this section. Otherwise Make sure that you put the bellow code on top of all your requests:
I advice you to put the above code in one of your service providers class in boot
method,
Then you should provide the bellow information on each request that you are performing:
Now at this stage, I really feel like you are ready to go. let's enjoy the package now 😎.
4. Generating a payment Qrcode
To generate a payment qrcode, all what you need is to place the bellow script in your code
Note: when you are expecting guhemba to send you a feedback when a transaction is done, then you should send the
$paymentReference
when generating a Qrcode, this is the reference of the product or group of products that your customer is buying. But also you need to provide a payment_confirmation_endpoint
in your wallet settings on Guhemba. this endpoint must accept POST
request. The endpoint will be hitted when the transaction is completed and it's will contain the following response:
The confirm_payment_key
will help you to secure your provided payment_confirmation_endpoint
, You shoud keep it safe After generating the qrcode because it is the unique key that will help you to check if the request is coming from guhemba.
5. Redirect user to guhemba
As guhemba payment gives a good user interface
where the qrcode
will appear so that user can scan it or can decide to hit the pay
button for completing the payment on guhemba.
Let's say, user decides to complete the payment on guhemba web then he hits the pay
button, you will need to redirect him on guhemba. To do that, just have a look:
By default this method will redirect user where he can choose a payment option(card,mtn,...). means if you already know the method that a user will pay with, you can pass the paymentOption
to the redirect method:
The slug
of the qrcode, you will get it after generating a qrcode and The paymentRef
is the reference of the order that your customer want to pay, this reference may help you to know which product your customer has paid after accomplishing his payment on guhemba.
Note
: Please make sure all information are well set in the config file
of guhemba
If you need to check the formated full url before your customer get redirected to guhemba, we give you the ability to dump the url
But also the package provide another alternative for checking the redirection full url by logging it:
6. Fetch transaction Info
You can fetch a transaction data in different ways:
6.1 Get transaction Info from a callback
When the user completes the payment on guhemba, he will be redirected back to your system using the value of GUHEMBA_REDIRECT_URL
that you have set in the config file.
Now to grab the transaction information that he has performed use this script:
For stateless, you can get the transaction in the following way
This time An extra field: reference
will be added on the transaction object
.
6.2 Get transaction Info using transaction token
It may happen that you need to check if a payment transaction Having a given token exits in your merchant wallet on guhemba, to do that you only need the bellow script:
6.3 Get transaction Info using a payment reference
You may need to check what happened to the transaction that you have initiated yet you don't have the transaction token, the package provides a way to check using the payment reference that you have provided when generating the qrcode
Note
: the $paymentConfirmKey
is optional but it is very important for fetching result with precision in case you are using your merchant wallet on different e-commerce
6.3 Get transaction Info using a Qrcode Id
You can also check if a transaction exists using the payment qrcode id that you have generated
7. Other methods that you need to use specially for Error handling
7.1 getResponse()
You can call this method on all requests except the redirect
method. For example you want to generate a qrcode:
The above script will give you the object that contains all properties of the response
7.1 isOk() and getMessage()
To check if the request was successfully done you can use the isOk
method to avoid bugs in your system. and also it may happen that the request was not successfully performed, at that time you will need to use the method getMessage()
Note
: The method isOkay
is a boolean and getMessage()
returns a string.
Enjoy guys.
All versions of guhemba-web-element with dependencies
laravel/framework Version >=7.0
kakaprodo/custom-data Version >=2.0.0 || dev-develop