Tutorial: Getting Started
Setting up the PHP library is straightforward: it is a matter of installing the library and instantiating it in your PHP application with the given credentials.
Requirements
PHP v8.0 or higher
Composer
Steps
Install the library through Composer. Run Composer to install this library and dependencies from your project folder.
composer require bluem-development/bluem-phpEnsure that you are loading the Composer packages in your application.
require __DIR__ . '/vendor/autoload.php';Read more about Composer in the docs.
Initialize a Bluem config object in your PHP application like so:
use Bluem\BluemPHP\Bluem; $bluem_config = new Stdclass();Set up the basic credentials and configuration settings:
$bluem_config->environment = "test" ; $bluem_config->senderID = ""; $bluem_config->brandID = ""; $bluem_config->test_accessToken = ""; $bluem_config->production_accessToken = "" ; $bluem_config->merchantReturnURLBase = "https://example.com"; $bluem_config->expectedReturnStatus = "success" ;The above settings are your credentials. They must be filled before the integration works.
Key
Value
environment 🔑
Fill in
prod,testoraccfor production, test or acceptance environments respectively.senderID 🔑
The sender ID, issued by Bluem. Always starts with an
S, followed by a number.brandID 🔑
Your BrandID is set at Bluem and given through email. It can vary for specific services: if so you will
test_accessToken 🔑
The access token to communicate with Bluem, for the test environment.
production_accessToken 🔑
The access token to communicate with Bluem, for the production environment.
merchantReturnURLBase
URL to return to after finishing the process. This should simply be alike to your domain name or webshop/website URL.
expectedReturnStatus
What status would you like to get back for a TEST transaction or status request?
Possible values: none, success, cancelled, expired, failure, open, pending
The credentials marked with a 🔑 will be provided to you by your Bluem account manager or contact.
You can then instantiate a new Bluem object in any of your classes:
$bluem_object = new Bluem($bluem_config);You can see a full example initialization in this file;
You are now ready to move on to actually using individual parts of the library!