PHP code example of mobiverse / appsnmobile-payment

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

    

mobiverse / appsnmobile-payment example snippets


return [
    'baseurl' => env('MOMO_BASEURL', ''),
    'callback_url'=>env('MOMO_CALLBACK_URL',''),
    'debit_transaction_prefix'=>env('MOMO_DEBIT_TRANSACTION_PREFIX',''),
    'credit_transaction_prefix'=>env('MOMO_CREDIT_TRANSACTION_PREFIX',''),
    'debit_callback_url'=>env('MOMO_DEBIT_CALLBACK_URL',''),
    'credit_callback_url'=>env('MOMO_CREDIT_CALLBACK_URL',''),
    'auth'=>[
        'basic'=>[
            'user'=>env('MOMO_BASICAUTH_USR',''),
            'pass'=>env('MOMO_BASICAUTH_PWD','')
        ]
    ],
    'purchase'=>[
        'balance'=>[
            'reference'=>env('MOMO_PURCHASE_BALANCE_REFERENCE','')
        ]
    ]
];

$momo_transaction = [
    'msisdn' => '0244377919',
    'network' => MomoTransaction::VODAFONE,
    'amount' => 0.10,
    'payment_request_id' => 1,
    'transaction_id' => $transaction_id
];

\Mobiverse\AppsnmobilePayment\AppsnmobilePaymentFacade::executeDebitRequest($momo_transaction);

public function debitCallback(\Mobiverse\AppsnmobilePayment\IAppsnmobilePayment $momoPaymentService, Request $request){
    $momoPaymentService->processDebitCallback($request->all());
    return response();
}

PaymentSucceeded::class => [
    SendReceipt::class,
],
PaymentFailed::class => [
    FailedPaymentNotification::class,
],
PaymentPending::class => [
    PaymentPaymentNotification::class,
]
bash
php artisan vendor:publish --provider="Mobiverse\AppsnmobilePayment\AppsnmobilePaymentServiceProvider" --tag="appsnmobile-payment-migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="Mobiverse\AppsnmobilePayment\AppsnmobilePaymentServiceProvider" --tag="appsnmobile-payment-config"