PHP code example of backbone / cheddar
1. Go to this page and download the library: Download backbone/cheddar 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/ */
backbone / cheddar example snippets
$client = new \Cheddar\Cheddar([
'key' => 'TEST',
'secret' => '00000000000000000000000000000000'
]);
$client->apiEndpoint('https://...');
$client->sandbox(true);
$payment = $client->payment()->create(
\Cheddar\Cheddar::SERVICE_CARDPAY, [
'amount' => 9.99,
'currency' => \Cheddar\Currencies::EUR,
'variable_symbol' => '1000000000',
'payer_name' => 'John Doe',
'description' => 'my first test payment',
'payer_email' => '[email protected] ',
'return_url' => 'https://my-test-server.dev',
'notification_url' => 'https://my-test-server.dev',
]
);
header('Location: ' . $payment->redirectUrl());
$payment = $client->payment()->details($uuid);
$client->message()->validate(
$_GET['uuid'], $_GET['signature']
);
$payment = $client->payment()->update($payment_uuid, [
'charge_on' => (new \Datetime('tomorrow'))->format('Y-m-d'),
'amount' => 11.99
]);
$payment = $client->payment()->refund($payment_uuid, [
'amount' => 11.99,
'currency' => \Cheddar\Currencies::EUR,
'reason' => 'requested_by_customer'
]);
bash
./vendor/bin/phpunit tests/CurlTransportTest.php