The WeGetFinancing SDK for PHP makes it easy for developers to access the WeGetFinancing API in their PHP code and integrate our payment gateway in their e-commerce, CRM, ERP, and any related web applications. You can get started in minutes by installing the SDK through Composer or by downloading a single zip from our latest release.
To run the SDK, your system will need to meet the minimum requirements of having PHP >= 7.4 with ext-json.
Using Composer is the recommended way to install the WeGetFinancing PHP-SDK.
The SDK is available via Packagist under the wegetfinancing/php-sdk
package.
If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:
composer require `wegetfinancing/php-sdk`
- Require the composer autoload and the packages.
<?php require 'vendor/autoload.php'; use WeGetFinancing\SDK\Client; use WeGetFinancing\SDK\Entity\Request\AuthRequestEntity; use WeGetFinancing\SDK\Entity\Request\LoanRequestEntity;
- Make an AuthResponseEntity and use it to initialise the client
$auth = AuthRequestEntity::make([ 'username' => '***', 'password' => '***', 'merchantId' => '***', 'url' => 'https://***' ]); $client = Client::Make($auth);
- Make an LoanRequestEntity, for more information about the parameter to use, please refer to the official documentation.
$request = LoanRequestEntity::make([ 'first_name' => '***', 'last_name' => '***', 'shipping_amount' => 1.2, 'version' => '1.9', 'email' => '***@example.com', 'phone' => '0123456789', 'merchant_transaction_id' => '***', 'success_url' => 'https://yoururl.com/successurl', // this is facultative 'failure_url' => 'https://yoururl.com/failureurl', // this is facultative 'postback_url' => 'https://yoururl.com/postbackurl', // this is facultative 'billing_address' => [ 'street1' => '***', 'city' => '***', 'state' => '***', 'zipcode' => '***', ], 'shipping_address' => [ 'street1' => '***', 'city' => '***', 'state' => '***', 'zipcode' => '***', ], 'cart_items' => [ [ 'sku' => '***', 'display_name' => '***', 'unit_price' => '***', 'quantity' => ***, 'unit_tax' => **.*, 'category' => '***', // Facultative ] ] ]);
- Use the LoanRequestEntity to make an application and receive a LoanResponseEntity with the result of it.
$response = $client->requestNewLoan($request);