1. Go to this page and download the library: Download klix-app/merchant-api-php 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/ */
klix-app / merchant-api-php example snippets
= new \Klix\KlixApi($config['brand_id'], $config['api_key'], $config['endpoint']);
$client = new \Klix\Model\ClientDetails();
$client->email = '[email protected]';
$purchase = new \Klix\Model\Purchase();
$purchase->client = $client;
$details = new \Klix\Model\PurchaseDetails();
$product = new \Klix\Model\Product();
$product->name = 'Test';
$product->price = 100;
$details->products = [$product];
$purchase->purchase = $details;
$purchase->brand_id = $config['brand_id'];
$purchase->success_redirect = 'https://portal.klix.app/api/v1/?success=1';
$purchase->failure_redirect = 'https://portal.klix.app/api/v1/?success=0';
$result = $klix->createPurchase($purchase);
if ($result && $result->checkout_url) {
// Redirect user to checkout
header("Location: " . $result->checkout_url);
exit;
}
= new \Klix\KlixApi($config['brand_id'], $config['api_key'], $config['endpoint']);
$client = new \Klix\Model\ClientDetails();
$client->email = '[email protected]';
$purchase = new \Klix\Model\Purchase();
$purchase->client = $client;
$details = new \Klix\Model\PurchaseDetails();
$paymentToFirstIbanProduct = new \Klix\Model\Product();
$paymentToFirstIbanProduct->name = 'Payment to first IBAN';
$paymentToFirstIbanProduct->price = 100;
$paymentToSecondIbanProduct = new \Klix\Model\Product();
$paymentToSecondIbanProduct->name = 'Payment to second IBAN';
$paymentToSecondIbanProduct->price = 200;
$details->products = [$paymentToFirstIbanProduct, $paymentToSecondIbanProduct];
$paymentMethodDetails = new \Klix\Model\PaymentMethodDetails();
$firstCreditor = new \Klix\Model\PisBulkPurchase();
$firstCreditor->creditor_name = 'John Doe';
$firstCreditor->creditor_iban = 'LVXXPARX0000000000001';
$secondCreditor = new \Klix\Model\PisBulkPurchase();
$secondCreditor->creditor_name = 'Jane Doe';
$secondCreditor->creditor_iban = 'LVXXHABA0000000000001';
$paymentMethodDetails->pis_bulk_purchase = [$firstCreditor, $secondCreditor];
$details->payment_method_details = $paymentMethodDetails;
$purchase->purchase = $details;
$purchase->brand_id = $config['brand_id'];
$purchase->payment_method_whitelist = ['swedbank_lv_pis'];
$purchase->success_redirect = 'https://portal.klix.app/api/v1/?success=1';
$purchase->failure_redirect = 'https://portal.klix.app/api/v1/?success=0';
$result = $klix->createPurchase($purchase);
if ($result && $result->checkout_url) {
// Redirect user to checkout
header("Location: " . $result->checkout_url);
exit;
}
json
{
"x/klix-sdk-php": "*@dev"
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.