Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created December 14, 2019 02:51
Show Gist options
  • Save staycreativedesign/45f8d55b3c199ce8c5b073076613b651 to your computer and use it in GitHub Desktop.
Save staycreativedesign/45f8d55b3c199ce8c5b073076613b651 to your computer and use it in GitHub Desktop.
function stripetokenhandler(token) {
// insert the token id into the form so it gets submitted to the server
var form = document.getelementbyid('payment-form');
var hiddeninput = document.createelement('input');
hiddeninput.setattribute('type', 'hidden');
hiddeninput.setattribute('name', 'stripetoken');
hiddeninput.setattribute('value', token.id);
form.appendchild(hiddeninput);
// submit the form
form.submit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment