PHP code example of blinkpay / laravel

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

    

blinkpay / laravel example snippets


use BlinkPay\Laravel\Facades\BlinkPay;

class PaymentController extends Controller
{    
    public function processMobileMoneyPayment(Request $request)
    {
        try {
            $result = BlinkPay::mobileMoney([
                'order_id' => $request->order_id,
                'amount' => $request->amount,
                'currency' => $request->currency,
                'phone_number' => $request->phone_number
            ]);
            
            return response()->json($result);
        } catch (\Exception $e) {
            return response()->json(['error' => $e->getMessage()], 400);
        }
    }
}

use BlinkPay\Laravel\Facades\BlinkPay;

class PaymentController extends Controller
{    
    public function processCreditCardPayment(Request $request)
    {
        try {
            $result = BlinkPay::processCreditCardPayment([
                'order_id' => $request->order_id,
                'amount' => $request->amount,
                'currency' => $request->currency,
                'card_number' => $request->card_number,
                'expiry_month' => $request->expiry_month,
                'expiry_year' => $request->expiry_year,
                'cvv' => $request->cvv,
                'card_holder_name' => $request->card_holder_name,
                'billing_address' => $request->billing_address,
                'billing_city' => $request->billing_city,
                'billing_country' => $request->billing_country,
                'billing_postal_code' => $request->billing_postal_code
            ]);
            
            return response()->json($result);
        } catch (\Exception $e) {
            return response()->json(['error' => $e->getMessage()], 400);
        }
    }
}
bash
php artisan vendor:publish --provider="BlinkPay\Laravel\BlinkPayServiceProvider"