PHP code example of corvuspay / corvuspay_wallet_php_sdk

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

    

corvuspay / corvuspay_wallet_php_sdk example snippets






$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$params = [
    'order_number'     => "order_number",
    'language'         => "language",
    'currency'         => "currency",
    'amount'           => "amount",
    'cart'             => "cart",
    '

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number"
    ]; 
$client->transaction->cancel($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number"
    ]; 
// or if you are completing a transaction with subscription
$params = [
    'order_number' => "order_number",
    'subscription' => "true",
    'account_id'   => "account_id"
    ]; 
$client->transaction->complete($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number",
    'new_amount'   => "new_amount",
    'currency'     => "currency"
    ];
$client->transaction->partiallyComplete($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number"
    ];
$client->transaction->refund($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number",
    'new_amount'   => "new_amount",
    'currency'     => "currency"
    ];
$client->transaction->partiallyRefund($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number",
    'account_id'   => "account_id"
    ];
// or if you want to pay the order with new amount
$params = [
     'order_number' => "order_number",
     'account_id'   => "account_id",
     'new_amount'   => "new_amount",
     'currency'     => "currency"
     ];
$client->subscription->pay($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number'    => "order_number",
    'currency_code'   => "currency_code"
    ];
$client->transaction->status($params);

$config = ['store_id' => "store_id", 'secret_key' => "secret_key", 'environment' => "environment"];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number'    => "order_number",
    'currency_code'   => "currency_code"
    ];
$client->pisTransaction->status($params);

$logger = new Monolog\Logger('Test');
$logger->pushHandler(new Monolog\Handler\StreamHandler(__DIR__ . '/app.log', Monolog\Logger::DEBUG));
$config = [
    'store_id'    => "store_id", 
    'secret_key'  => "secret_key", 
    'environment' => "environment",
    'logger'      =>  $logger
    ];
$client = new CorvusPay\CorvusPayClient($config);
$fp = fopen("path/to/file", 'r');
$client->setCertificate($fp, "certificate_password");
$params = [
    'order_number' => "order_number"
    ];
$client->transaction->refund($params);
json
{
  "vuspay/corvuspay_wallet_php_sdk": "*"
  },
  "repositories": [
    {
      "type": "git",
      "url":  "https://github.com/corvuspay/corvuspay_wallet_php_sdk.git"
    }
  ]
}