Download the PHP
package bsecure/bsecure-php without Composer
On this page you can find all versions of the php package
bsecure/bsecure-php. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
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.
bSecure is a utility library for two-click checkout custom integration. bSecure library simplifies communication between builder and bSecure server and processing tasks for builder's ease.
About bSecure Checkout
It gives you an option to enable universal-login, two-click checkout and accept multiple payment method for your customers, as well as run your e-commerce store hassle free.\
It is built for desktop, tablet, and mobile devices and is continuously tested and updated to offer a frictionless payment experience for your e-commerce store.
Manual Installation
To use the bindings, include the init.php file.
require_once('/path/to/bSecure-php/init.php')
Prerequisites
The bindings require the following extensions in order to work properly:
curl
If you want to install the package manually, you'll have to make sure that these extensions are available.
Documentation
Visit our Site bSecure to read the documentation and get support.
Configuration Setup
By following a few simple steps, you can set up your bSecure Checkout and Single-Sign-On.
Fill following fields:\
a. Store URL its required in any case\
b. Login Redirect URL Required for feature Login with bSecure\
c. Checkout Redirect URL Required for feature Pay with bSecure\
d. Checkout Order Status webhook Required for feature Pay with bSecure
Save your client credentials (' and ')
Please make sure to keep credentials at safe place in your code.
Client Authentication
To call below mentioned functions of bSecure, you first have to authenticate your client.
Following function will be used to authenticate your client:
``
and can be obtained from Builder's Portal for your application.
``
We suggest to call this function before each of the following to keep authentication updated:
* create_order
* order_status
* get_customer_profile
## bSecure Checkout
#### Create Order
To create an order you should have an order_id, customer, charges and products object parameters that are to be set before creating an order.
##### Create Order Request Params:
###### Product Object:
Products object should be in below mentioned format:
###### Shipment Object
Shipment object should be in below mentioned format:
>1- If the merchant want his pre-specified shipment method then he should pass shipment method detail in below mentioned format:
###### Customer Object
Customer object should be in below mentioned format:
>1- If the customer has already signed-in via bSecure into your system and you have auth-code for the customer you can
just pass that code in the customer object no need for the rest of the fields.
>2- Since all the fields in Customer object are optional, if you don’t have any information about customer just pass the
empty object, or if you have customer details then your customer object should be in below mentioned format:
###### Charges Object
Charges object should be in below mentioned format:
#### Create Order
In response createOrder(), will return order expiry, checkout_url, order_reference and merchant_order_id.
>If you are using a web-solution then simply redirect the user to checkout_url
When order is created successfully on bSecure, you will be redirected to bSecure checkout app where you will process your checkout.
>If you have Android or IOS SDK then initialize your sdk and provide order_reference,checkout_url and store_url to it
#### Callback on Order Placement
Once the order is successfully placed, bSecure will redirect the customer to the url you mentioned in “Checkout
redirect url” in your [environment settings](https://builder.bsecure.pk/) in [Builder's Portal](https://builder.bsecure.pk/), with one additional param **order_ref** in the query
string.
#### Order Updates
By using order_ref you received in the "**[Callback on Order Placement](#callback-on-order-placement)**" you can call below method to get order details.
#### Order Status Change Webhook
Whenever there is any change in order status or payment status, bSecure will send you an update with complete
order details (contents will be the same as response of *[Order Updates](#order-updates)* on the URL you mentioned in *Checkout Order Status webhook* in your environment settings in [Builder's Portal](https://builder.bsecure.pk/). (your webhook must be able to accept POST request).
In response of "**[Callback on Order Placement](#callback-on-order-placement)**" and "**[Order Updates](#order-updates)**" you will recieve complete details of your order in below mentioned format:
### Managing Orders and Payments
#### Payment Status
| ID | Value | Description |
| :-: | :-------- | :------------------------------------------------------------------ |
| 0 | Pending | Order received, no payment initiated.Awaiting payment (unpaid). |
| 1 | Completed | Order fulfilled and complete. Payment also recieved. |
| 2 | Failed | Payment failed or was declined (unpaid) or requires authentication. |
#### Order Status
| ID | Value | Description |
| :-: | :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Created | A customer created an order but not landed on bsecure |
| 2 | Initiated | Order is awaiting fulfillment. |
| 3 | Placed | Order fulfilled and complete Payment received. Order is awaiting fulfillment. – requires no further action |
| 4 | Awaiting Confirmation | Awaiting action by the customer to authenticate the transaction. |
| 5 | Canceled | Canceled by an admin or the customer. |
| 6 | Expired | Orders that were not fulfilled within a pre-specified timeframe. timeframe |
| 7 | Failed | Payment failed or was declined (unpaid).Note that this status may not show immediately and instead show as Pending until verified |
| 8 | Awaiting Payment | Order received, no payment initiated. Awaiting payment (unpaid) |
## bSecure Single Sign On (SSO)
### Authenticate Client
You can authenticate your client by calling below mentioned function
Save the provided **state** as you will receive the same state in the successful authorization callback.
In response clientAuthenticate(), will return a redirect_url, on which you have to redirect your customer.
### Client Authorization
On Successful Authorization,\
bSecure will redirect to you provided when setting up environment in Builders portal, along
with two parameters in query string: **code** and **state**
code received in above callback is customer's auth_code which will be further used to get customer profile.
#### Verify Callback
Verify the state you received in the callback by matching it to the value you stored in DB before sending the client authentication
request, you should only proceed if and only if both values match.
### Get Customer Profile
Auth_code recieved from **[Client Authorization](#client-authorization)** should be passed to method below to get customer profile.
In response, it will return customer name, email, phone_number, country_code, address book.
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.
## Contributions
**"bSecure – Your Universal Checkout"** is open source software.
Requiresphp Version
>=5.6.0 ext-curl Version
* ext-json Version
* ext-mbstring Version
*
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 bsecure/bsecure-php contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.