Skip to content

Instantly share code, notes, and snippets.

@subomi
Created November 1, 2016 13:38
Show Gist options
  • Save subomi/67103133a9ba2ed0fe1613641a2edc19 to your computer and use it in GitHub Desktop.
Save subomi/67103133a9ba2ed0fe1613641a2edc19 to your computer and use it in GitHub Desktop.
function makepayment(key, email, amount, ref, callback) {
var handler = PaystackPop.setup({
key: key, // This is your public key only!
email: email || 'customer@email.com', // Customers email
amount: amount || 5000000.00, // The amount charged, I like big money lol
ref: ref || 6019, // Generate a random reference number and put here",
metadata: { // More custom information about the transaction
custom_fields: [
{}
]
},
callback: callback || function(response){
let div = document.getElementsByTagName("div")[0]
div.innerHTML = "This was the json response reference </br />" + response.reference;
},
onClose: function(){
alert('window closed');
}
});
// Payment Request Just Fired
handler.openIframe();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment