LP Subs test - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of LP Subs test.php

  1. <?php
  2. $api_secret = '';
  3. $linkpay_prefix = 'https://igw.every-pay.dev/lp';
  4. $params = [
  5.   'linkpay_token' => 'nwygsc', 
  6.   'order_reference' => 'ord' . rand(1000,9999),
  7.   'customer_name' => 'A Nice Guy',
  8.   'customer_email' => '[email protected]'
  9. ];
  10.  
  11. $query = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
  12. echo '<p>HMAC will be calculated from query string: ' . "\n". $query . "</p>";
  13. $hmac = hash_hmac('sha256', $query, $api_secret);
  14.  
  15. $url = "${linkpay_prefix}?${query}&hmac=${hmac}";
  16. echo "<p><a href='$url' target='blank'>$url</a></p>";
  17.  
  18.  
  19. # outputs:
  20. # https://igw-staging.every-pay.com/lp?linkpay_token=w23gd4&order_reference=ord123&email=customer%40example.com&hmac=c3a1b093a5e322bf9a40505b41856efb1ca1f9d9123b9530d78f9018eb25a983
  21.  
File Description
  • LP Subs test
  • PHP Code
  • 10 Jan-2020
  • 739 Bytes
You can Share it: