hopeofiran/nicardpayment

You can make your Nick Card payments with this package.

v1.0.3 2022-11-05 12:13 UTC

This package is auto-updated.

Last update: 2024-05-30 00:53:53 UTC


README

Laravel Parsian Refund provides amount refundation.

License

Laravel Persian Validation is open-sourced software licensed under the MIT license

Requirement

  • Laravel 8.* to up
  • PHP 7.3 to up

Install

Via Composer

$ composer require hopeofiran/nicardpayment

Config

Add the following provider to providers part of config/app.php

HopeOfIran\NicardPayment\Providers\NicardPaymentProvider::class

vendor:publish

You can run vendor:publish command to have custom config file of package on this path ( config/parsianRefund.php )

php artisan vendor:publish --provider=HopeOfIran\NicardPayment\Providers\NicardPaymentProvider

Sample code (payment)

Route::any('/payment', function () {
return \HopeOfIran\NicardPayment\Facades\NicardPaymentFacade::creditAmount(200000)
        ->cashAmount(0)
        ->callbackUrl(\route('payment.verification'))
        ->backUrl(\route('payment.verification'))
        ->installmentsCountList([3, 4])
        ->purchase(function (\HopeOfIran\NicardPayment\NicardPayment $nicardPayment, \Illuminate\Http\Client\Response $response, $data) {
            return $nicardPayment->pay($data['open_cpg_url']);
            return 'payment failed';
        });
})->name('payment');

Sample code (verification)

Route::any('/payment/verification', function (\Illuminate\Http\Request $request) {
    $response = \HopeOfIran\NicardPayment\Facades\NicardPaymentFacade::verify($request->input('tid'));
    if ($response->successful()) {
        return $response['is_totally_success'];
    }
    return $response->collect()->get('status');
})->name('payment.verification');