PHP Classes

File: js/paystack.html

Recommend this page to a friend!
  Classes of bamigboye biodun   Logical Functions   js/paystack.html   Download  
File: js/paystack.html
Role: Auxiliary data
Content type: text/plain
Description: Example page to make a payment with the Paystack service
Class: Logical Functions
General-purpose PHP and JavaScript functions
Author: By
Last change:
Date: 9 months ago
Size: 1,272 bytes


Class file image Download
<!DOCTYPE html> <html lang="en"> <head></head> <body> </body> </html> <script src=""></script> <script> const payWithPayStack= (payStackPublicKey,amount,email='',phone=00000000000,currency='NGN') => { return new Promise((resolve) => { amount = amount * 100; var handler = PaystackPop.setup({ key: payStackPublicKey, email: email, amount: amount, currency: currency, metadata: { custom_fields: [{ display_name: "Mobile Number", variable_name: "mobile_number", value: amount, }] }, callback: function(response) { resolve(response) }, onClose: function() { alert("Transaction Cancelled") } }); handler.openIframe(); }) //-- Promise Ends Here } //-- Usage payWithPayStack( 'pk_test_597ab21e3648f1fee27c53efcdbf2e235df101d6', 5000, '' ,090764636574,'NGN' ).then((response) =>{ console.log(response) }) /* Author : Biodun Bamigboye Email, Phone and Currency is Optional */ </script>