1. Go to this page and download the library: Download lunar/payments-api-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/ */
$lunar = new \Lunar\Lunar($private_secret_key);
try {
$payments = $lunar->transactions();
$payments->capture($transaction_id, [
'amount' => [
'decimal'=> '10',
'currency' => 'EUR'
]
]);
} catch (\Lunar\Exception\NotFound $e) {
// The transaction was not found
} catch (\Lunar\Exception\InvalidRequest $e) {
// Bad (invalid) request - see $e->getJsonBody() for the error
} catch (\Lunar\Exception\Forbidden $e) {
// You are correctly authenticated but do not have access.
} catch (\Lunar\Exception\Unauthorized $e) {
// You need to provide credentials (an app's API key)
} catch (\Lunar\Exception\Conflict $e) {
// Everything you submitted was fine at the time of validation, but something changed in the meantime and came into conflict with this (e.g. double-capture).
} catch (\Lunar\Exception\ApiConnection $e) {
// Network error on connecting via cURL
} catch (\Lunar\Exception\ApiException $e) {
// Unknown api error
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.