PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/iframe-with-md5-hash.php

https://bitbucket.org/juspay/juspay-integration-code-samples
PHP | 30 lines | 17 code | 8 blank | 5 comment | 0 complexity | 7cb223ce0502ee529f247b21f4b7f81a MD5 | raw file
  1. <?php
  2. # This example shows to use the iFrame based solution without the call to /order/create API.
  3. # Replace the below with your credentials.
  4. $api_key = '782CB4B3F5B84BDDB3C9EAFA6A134DC3';
  5. $merchant_id = 'guest';
  6. $order_id = rand();
  7. $amount = '10.00';
  8. $customer_id = 'customerId';
  9. $customer_email = 'customer@mail.com';
  10. # Compute the signature that need to be sent to our servers.
  11. # Signature to be hashed should be of format api_key|merchant_id|order_id|amount|customer_id|customer_email
  12. $hash = md5("$api_key|$merchant_id|$order_id|$amount|$customer_id|$customer_email");
  13. echo "<center><b>Juspay Integration Example</b></center>";
  14. echo "<br /><br />";
  15. # Now embed the iFrame with the computed hash and also other required details.
  16. echo " <center>
  17. <iframe src=\"https://api.juspay.in/merchant/ipay?merchant_id=$merchant_id&order_id=$order_id&amount=$amount&customer_id=$customer_id&customer_email=$customer_email&signature=$hash\"
  18. width=\"630\" height=\"400\" style=\"border: 1px solid #CCC;padding: 20px;height: auto;min-height: 300px;\">
  19. </iframe>
  20. </center>
  21. ";
  22. ?>