PHP code example of rocapayofficial / rocapay-php

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

    

rocapayofficial / rocapay-php example snippets



pay = new \Rocapay\Rocapay($apiKey);

 
 $rocapay = new \Rocapay\Rocapay($apiKey);
 $params = array(
    'amount'            => '12.00', // Amount of the payment
    'fiatCurrency'      => 'USD', // Symbol used to specify the fiat currency (ISO 4217)
    'callbackUrl'       => 'https://yoursite.com/callback-url', // URL on which JSON notifications will be received about the payment (Optional if a global one is set from the user dashboard)
    'description'       => 'Order #0291092', // Description of the payment (Optional)
    'cryptoCurrency'    => 'BTC', // Symbol used to specify the crypto currency (Optional)
    'convertToCurrency' => 'EUR', // Symbol used to specify the currency to which the crypto currency will be converted to. A list of supported convertable currency pairs can be obtained through the `getAutoConvertCurrencyPairs` method (Optional)
    'successUrl'        => 'https://yoursite.com/success-url', // Redirect URL after a successful payment in the widget (Optional if a global one is set from the user dashboard)
    'failUrl'           => 'https://yoursite.com/fail-url', // Redirect URL after a failed payment in the widget (Optional if a global one is set from the user dashboard)	
    'cancelUrl'         => 'https://yoursite.com/cancel-url', // Redirect URL after clicking the Return to Merchant button in the widget (Optional if a global one is set from the user dashboard)	
 );
 $payment = $rocapay->createPayment($params);
bash
composer