PHP code example of momotolabs / sdk-biller

1. Go to this page and download the library: Download momotolabs/sdk-biller 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/ */

    

momotolabs / sdk-biller example snippets


use Momotolabs\SdkBiller\Core\Config;

$settings = [
    'base_url' => $_ENV['BILLER_BASE_URL'],
    'headers' => [
        "X-Business-Id" => $_ENV['BILLER_BUSSINESS_ID'],
        "X-Pos-Id" => $_ENV['BILLER_POS_ID'],
        "X-Member-Code" => $_ENV['BILLER_MEMBER_CODE'],
    ],
    'client_id' => $_ENV['BILLER_CLIENT_ID'],
    'client_secret' => $_ENV['BILLER_CLIENT_SECRET'],
];

$config = new Config($settings);

use Momotolabs\SdkBiller\Core\ClientGuzzleHttp;
use Momotolabs\SdkBiller\Resource\BillerService;

$client = new ClientGuzzleHttp($config);
$service = new BillerService($client);

use Momotolabs\SdkBiller\Resource\DTO\FE\BodyItem;
use Momotolabs\SdkBiller\Resource\DTO\Shared\PaymentItem;
use Momotolabs\SdkBiller\Resource\DTO\FE\FEBuilder;

$fe = (new FEBuilder())
    ->addBodyItem(
        new BodyItem(
            itemType: 1,
            quantity: 1,
            unitMeasure: 99,
            code: "1234",
            description: 'Producto 1',
            unitPrice: 100.00
        ),
    )->addPaymentItem(
        new PaymentItem(
            code: "02",
            term: "01",
            reference: "4081151108",
        )
    )->withOperationCondition(1);

$service->send($fe->build());
.php