PHP code example of ayvazyan10 / ameriabankvpos

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

    

ayvazyan10 / ameriabankvpos example snippets

` bash
php artisan vendor:publish --provider="Ayvazyan10\AmeriaBankVPOS\AmeriaBankVPOSServiceProvider"
` bash
php artisan migrate
` php
public function cancelPayment(int|string $paymentId): array;

public function check($request): array;

public function getPaymentDetails(int|string $paymentId): array;

public function pay(int|float $amount, int $orderId, array $options = []): array;

public function refund(int|string $paymentId, int|float $refundAmount): array;

public function makeBindingPayment(int|float $amount, int $orderId, array $options = []): array;

public function getBindings(): array;

public function deactivateBinding(string $cardHolderId): array;

public function activateBinding(string $cardHolderId): array;
` php
use Ayvazyan10\AmeriaBankVPOS\Facades\AmeriaBankVPOS;
use Illuminate\Http\Request;

// In your controller method, where you handle the payment response
public function handlePaymentResponse(Request $request)
{
    $response = AmeriaBankVPOS::check($request);

    if ($response['status'] === 'SUCCESS') {
        // Handle successful payment
        $transaction = $response['transaction'];
        // You can retrieve additional transaction data as needed
        // For example: $transaction->order_id, $transaction->user_id, etc.
    } else {
        // Handle failed payment
        // Also can retrieve additional transaction data as needed
    }
}