PHP code example of drsdre / laravel-hellocash
1. Go to this page and download the library: Download drsdre/laravel-hellocash 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/ */
drsdre / laravel-hellocash example snippets
'providers' => [
drsdre\HelloCash\HelloCashServiceProvider::class,
]
return [
'principal' => env('HELLOCASH_PRINCIPAL'),
'credentials' => env('HELLOCASH_CREDENTIALS'),
'token' => env('HELLOCASH_TOKEN'),
'system' => env('HELLOCASH_SYSTEM'),
'webhook_secret' => env('HELLOCASH_WEBHOOK_SECRET'),
];
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use drsdre\HelloCash\WebhookController as BaseController;
class WebhookController extends BaseController
{
/**
* Handle payment notifications.
*
* @param Request $request
*/
protected function handleEventNotification(Request $request)
{
$event = $request->EventData;
}
}
Route::match(['post', 'get'], 'hellocash/webhooks', 'WebhookController@handle');
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'hellocash/webhooks',
];
}
$HC_invoice = app(drsdre\HelloCash\Requests\Invoice::class);
$invoice = $HC_invoice->create(
...
);
$HC_invoice = app(drsdre\HelloCash\Requests\Invoice::class);
$invoice = $HC_invoice->get('175936509216');
$HC_invoice = app(drsdre\HelloCash\Requests\Invoice::class);
$invoices = $HC_invoice->search(['status' => 'PENDING']);
$HC_invoice = app(drsdre\HelloCash\Requests\Invoice::class);
$response = $HC_invoice->remove('175936509216');
$HC_transfer = app(drsdre\HelloCash\Transfer::class);
$transfer = $HC_transfer->create(
...
);
$HC_transfer = app(drsdre\HelloCash\Transfer::class);
$transfers = $HC_transfer->search(['status' => 'PENDING']);
$HC_transfer = app(drsdre\HelloCash\Transfer::class);
$transfer = $HC_transfer->get('LUC00000248255ETH');
$HC_transfer = app(drsdre\HelloCash\Transfer::class);
$response = $HC_transfer->cancel(['LUC00000248255ETH']);
$HC_transfer = app(drsdre\HelloCash\Transfer::class);
$response = $HC_transfer->authorize(['LUC00000248255ETH']);
$webhook = app(drsdre\HelloCash\Webhook::class);
$key = $webhook->verify();