1. Go to this page and download the library: Download comfino/php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comfino / php-sdk example snippets
use Comfino\Backend\Factory\ApiClientFactory;
use Comfino\Backend\Factory\OrderFactory;
use Comfino\Enum\LoanType;
// 1. Create the API client.
$client = (new ApiClientFactory())->createClient(
httpClient: $httpClient,
requestFactory: $requestFactory,
streamFactory: $streamFactory,
apiKey: 'your-api-key'
);
// 2. Build an order.
$order = (new OrderFactory())->createOrder(
orderId: 'ORDER-123',
orderTotal: 150000, // in cents/grosz
deliveryCost: 1500, // in cents/grosz
loanTerm: 12, // months
loanType: LoanType::INSTALLMENTS_ZERO_PERCENT,
cartItems: $cartItems,
customer: $customer,
returnUrl: 'https://my-shop.com/order/confirm',
notificationUrl: 'https://my-shop.com/comfino/webhook/status'
);
// 3. Submit the loan application.
$response = $client->createOrder($order);
header('Location: ' . $response->applicationUrl);
use Comfino\Api\ApiContext;
use Comfino\Backend\Factory\ApiClientFactory;
$sharedClient = (new ApiClientFactory())->createSharedClient($httpClient, $requestFactory, $streamFactory);
$response = $sharedClient->createOrder(new ApiContext($apiKey, tenantKey: $merchantId), $order);
bash
> composer
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.