index.php 961 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. *
  4. * Description
  5. *
  6. * @package Paystack
  7. * @category Source
  8. * @author Michael Akanji <matscode@gmail.com>
  9. * @date 2017-06-26
  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. use Matscode\Paystack\Utility\Http;
  17. $secretKey = 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  18. // creating the transaction object
  19. $Transaction = new Transaction( $secretKey );
  20. // Set data to post using this method
  21. /*
  22. $response = $Transaction->initialize( [
  23. 'email' => 'customer@email.com',
  24. 'amount' => 500000
  25. ] );
  26. */
  27. // OR
  28. $response =
  29. $Transaction
  30. ->setEmail( 'matscode@gmail.com' )
  31. ->setAmount( 50 )
  32. ->initialize();
  33. // print response
  34. Debug::print_r( $response );
  35. // save reference somewhere and do a redirect
  36. Http::redirect($response->authorizationUrl);