PHP code example of binarycabin / brainblocks

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

    

binarycabin / brainblocks example snippets


Route::post('/pay', function(Request $request){
    $brainBlocksResponse = \BrainBlocks::getTokenResponse($request->brainblocks_token);
    $responseIsValid = \BrainBlocks::validateResponse($brainBlocksResponse,[
        'amount_rai' => 200,
    ]);
    dump($brainBlocksResponse);
    if($responseIsValid){
    	//.. do successful stuff
    }
});

$responseIsValid = \BrainBlocks::validateResponse($brainBlocksResponse,[
	'amount_rai' => 1000,
	'destination' => 'xrb_1kojnrrw8rtybqsqk5uh7bcioo8thkiqjkibmn43togd416gzfye6j44b9sc',
]);