PHP code example of noweh / laravel-payzen

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

    

noweh / laravel-payzen example snippets


     $blocks_html = \Payzen::set_amount(300)
        ->set_trans_id(123456)
        ->set_order_info(\Payzen::ascii_transcode('an information', 'an', 255, true))
        ->set_order_info2(\Payzen::ascii_transcode('another information', 'an', 255, true))
        ->set_url_return(request()->fullUrl())
        ->set_return_mode('POST')
        ->set_signature()
        ->get_form('<div><input id="spSubmit" type="submit" value="Pay" class="Button Button--black"></div>')
    ;

     $payzen = \Payzen::set_params(\Arr::where(request()->all(), function($value, $key) {
                 	return strrpos($key, 'vads_', -5) !== false;
             	}))
     			->set_signature()
     		;
             return (request()->input('signature') && ($payzen::get_signature() === request()->input('signature')));
    ;

    \Payzen::add_product(
        [
            'label' => 'Concert Coldplay 2016',
            'amount' => 235.00,
            'type' => 'ENTERTAINMENT',
            'ref' => 'COLD016',
            'qty' => 3
        ]
    );

   $payzen = \Payzen::add_product(
       [
           'label' => 'Concert Coldplay 2016',
           'amount' => 235.00,
           'type' => 'ENTERTAINMENT',
           'ref' => 'COLD016',
           'qty' => 3
       ]
   );
   $payzen->set_amount();
   echo $payzen->get_amount(); //will display 705.00 (3*235.00)

  $payzen = \Payzen::add_product(
      [
          'label' => 'Concert Coldplay 2016',
          'amount' => 235.00,
          'type' => 'ENTERTAINMENT',
          'ref' => 'COLD016',
          'qty' => 3
      ]
  );
  $payzen->set_amount();
  echo $payzen->get_amount(); //will display 705.00 (3*235.00)
  echo $payzen->get_amount(false); //will display 70500 (3*235.00)

   \Payzen::set_params(
       [
           'vads_page_action' => 'PAYMENT',
           'vads_action_mode' => 'INTERACTIVE',
           'vads_payment_config' => 'SINGLE',
           'vads_version' => 'V2',
           'vads_trans_date' => gmdate('YmdHis'),
           'vads_currency' => '978'
       ]
   );

    \Payzen::ascii_transcode('123nd', 'n', 5, true);

    \Payzen::isResponseSignatureValid();