PHP code example of icekristal / robokassa-for-laravel

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

    

icekristal / robokassa-for-laravel example snippets


composer 

 'robokassa' => [
    'login' => env('ROBOKASSA_LOGIN', 'login'),
    'password_one' => env('ROBOKASSA_PASSWORD_ONE', null),
    'password_two' => env('ROBOKASSA_PASSWORD_TWO', null),
    'password_test_one' => env('ROBOKASSA_PASSWORD_TEST_ONE', null),
    'password_test_two' => env('ROBOKASSA_PASSWORD_TEST_TWO', null),
    'webhook_domain' => env('ROBOKASSA_WEBHOOK_DOMAIN', null),
    'result_url' => env('ROBOKASSA_RESULT_URL', '/robokassa/payment/result'),
    'success_url' => env('ROBOKASSA_SUCCESS_URL', '/robokassa/payment/success'),
    'fail_url' => env('ROBOKASSA_FAIL_URL', '/robokassa/payment/fail'),
],

php artisan vendor:publish --provider="Icekristal\RobokassaForLaravel\RobokassaServiceProvider" --tag='config'

php artisan vendor:publish --provider="Icekristal\RobokassaForLaravel\RobokassaServiceProvider" --tag='migrations'

php artisan migrate

use Icekristal\RobokassaForLaravel\Facades\Robokassa;

$paymentUrl = Robokassa::setSum(100)
->setCurrency("USD")
->setDescription("Description order")->getPaymentUrl();

//optional
$paymentUrl = Robokassa::setSum(100)
->setCurrency("USD")
->setDescription("Description order")
->setOwner(\Illuminate\Database\Eloquent\Model::class) //Model owner order
->setEmail('[email protected]') //Email owner order
->setShpParams(['param_1' => 'value_1', 'param_2' => 'value_2']) //Additional params
->setExpirationDate(Carbon::now()->addDay()) //Expiration date payment
->getPaymentUrl();