sagleft / utopia-cryptonat
Crypton Donation Library (Utopia Ecosystem)
Fund package maintenance!
Tidelift
Requires
- php: ^7.0
- sagleft/utopialib-php: ^1.0
Requires (Dev)
- phpunit/phpunit: ^7.0 || ^8.0
- vlucas/phpdotenv: ^3.3
This package is auto-updated.
Last update: 2025-03-12 18:51:16 UTC
README
Crypton Donation Library (Utopia Ecosystem)
Installation with Composer
composer require sagleft/utopia-cryptonat
Usage
An instance of the Cryptonat\Handler object is created based on UtopiaLib\Client:
$cryptonat = new Cryptonat\Handler($client);
or
$cryptonat = new Cryptonat\Handler(); $cryptonat->setUtopiaClient($client);
Then try activating the voucher:
$voucher_code = 'UTP-P3FH-OJQZ-7XWI-CAVT-LYDW'; $result = $cryptonat->activateVoucher($voucher_code); echo json_encode($result);
response example:
{ "status": "pending", "referenceNumber": "367404A95932624C284B16AF1C1EDF1BB0F9CDCA1CC5136B167378BBF933FAD8", "amount": 0 }
check voucher status by reference number:
$referenceNumber = '367404A95932624C284B16AF1C1EDF1BB0F9CDCA1CC5136B167378BBF933FAD8'; $result = $cryptonat->checkVoucherStatus($referenceNumber); echo json_encode($result);
response example:
{ "status": "done", "created": "2020-01-14T13:18:21.232", "amount": 2, "comments": "", "direction": 1, "trid": "0ZWTT62Z4DO51" }
License
Utopia Cryptonat is licensed under The MIT License.