callback.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. *
  4. * Description
  5. *
  6. * @package Paystack
  7. * @category Source
  8. * @author Michael Akanji <matscode@gmail.com>
  9. * @date 2017-06-27
  10. * @copyright (c) 2016 - 2017, TECRUM (http://www.tecrum.com)
  11. *
  12. */
  13. require_once "../vendor/autoload.php";
  14. use Matscode\Paystack\Transaction;
  15. use Matscode\Paystack\Utility\Debug;
  16. $secretKey = 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  17. // creating the transaction object
  18. $Transaction = new Transaction( $secretKey );
  19. // transaction can be verified by doing manual check on the response Obj
  20. /*
  21. $response = $Transaction->verify();
  22. Debug::print_r( $response);*/
  23. // OR
  24. $result = $Transaction->isSuccessful();
  25. /*
  26. Debug::print_r( $result);
  27. */
  28. // To check if verified amount is the expected amount before giving value to customer
  29. $result = $Transaction->amountEquals(5000); // amount in kobo
  30. Debug::printStr( $result );
  31. // Getting AuthorizationCode
  32. /*
  33. $authorizationCode = $Transaction->getAuthorizationCode();
  34. Debug::print_r( $authorizationCode);
  35. */