1. Go to this page and download the library: Download krugerdavid/laravel-bancard 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/ */
krugerdavid / laravel-bancard example snippets
use KrugerDavid\Bancard\Facades\Bancard;
$result = Bancard::singleBuy(
shopProcessId: 54322,
amount: '10330.00',
description: 'Ejemplo de pago',
returnUrl: 'https://tusitio.com/finish'
);
// $result['process_id'] → usar en Bancard.Checkout.createForm()
// $result['status'] → 'success'
use KrugerDavid\Bancard\BancardManager;
class PaymentController
{
public function __construct(
private BancardManager $bancard
) {}
public function checkout()
{
$result = $this->bancard->singleBuy(...);
}
}
use KrugerDavid\Bancard\DTOs\Billing;
use KrugerDavid\Bancard\DTOs\BillingDetail;
$billing = new Billing(
clientRuc: '123456-1',
clientName: 'JUAN GONZALEZ',
clientEmail: '[email protected]',
commerceStamp: '12559969',
commerceExpeditionPoint: '001',
commerceEstablishment: '002',
details: [
new BillingDetail('Item 1', '10000.00', 10, 1),
new BillingDetail('Item 2', '330.00', 10, 1),
]
);
Bancard::singleBuy(54322, '10330.00', 'Pago', 'https://x.com', [
'billing' => $billing,
]);