PHP code example of aamroni / aamarpay

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

    

aamroni / aamarpay example snippets


use Aamroni\Aamarpay\AamarpayPaymentManager;
use Aamroni\Aamarpay\Entities\CustomerPayload;
use Aamroni\Aamarpay\Entities\PurchasePayload;
use Aamroni\Aamarpay\Facades\Aamarpay;

// @step01: Create a customer instance
$customer = CustomerPayload::instance(
    name:       'Kabir Khan',
    email:      '[email protected]',
    phone:      '+8801645770422',
    street1:    'House B-158 Road 22',
    street2:    'Baridhara DOHS',
    city:       'Dhaka',
    state:      'Dhaka',
    country:    'Bangladesh'
);

// @step02: Create a products instance
$purchase = PurchasePayload::instance(
    invoice:    'INV-00001',
    amount:     10.0,
    detail:     'Something about service or product'
);

// @step03: Process the checkout
$response = Aamarpay::checkout(purchase: $purchase, customer: $customer);
// or using facade
$response = AamarpayPaymentManager::instance()->checkout(purchase: $purchase, customer: $customer);

dd($response);
shell
php artisan vendor:publish --tag=aamroni-aamarpay