Integrated crypto payments for global businesses
PHP 5.3.0 and later.
Via Composer
composer require starkpay-php/starkpay
<?php
// including autoload file.
require __DIR__.'/vendor/autoload.php';
// Creating a new payment object ($apiKey) visit http://dashboard.starkpayments.net to get API Key
$payment = new \Starkpayments\Payment('<api_key>');
// Get pay object ($amount, $currency (EUR,USD etc), $description, $returnUrl)
$pay = $payment->getUrl(23.5, 'USD', 'Invoice 2223', 'https://mydomain.com/payment_return.php');
if ($pay->isSuccess()) {
//redirect URL
$redirect_url = $pay->getRedirectUrl();
header("location: $redirect_url");
} else {
echo $pay->getErrorMessage();
}
?>
<?php
if ($payment->paymentIsValid()) {
echo "Payment Successful";
} else {
echo "Payment Failed, Error : ". $payment->getErrorMessage();
}
?>
PHP unit test
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/ --coverage-html reports --whitelist src
The MIT License (MIT). Please see License File for more information.