Submit a form after checkout

315 views
Skip to first unread message

Mike Tarantino

unread,
Apr 21, 2015, 1:10:27 PM4/21/15
to api-d...@lists.stripe.com
I'm using the custom jquery checkout. After the checkout I'm trying to automatically submit a form. It seems like the process starts but then is cut off. Is stripe resetting the page?

<script>
  var handler = StripeCheckout.configure({
    key: 'pk_test_6KcQj3UijcxNQqfpAM4ORz7b',
    image: '/images/VR-logo-480x360.png',
    token: function(token) {
                      $("#regform").submit();
   }
});
  
$('#customButton').on('click', function(e) {
 var grtotal;
 grtotal = document.getElementById('total').value;
     // Open Checkout with further options
    handler.open({
      name: 'Verticle Runner',
      description: '[[!+fi.pagetitle]]',
      amount: parseInt(grtotal * 100),
 email: "[[+modx.user.id:userinfo=`email`]]"
});
    e.preventDefault();
});
  // Close Checkout on page navigation
  $(window).on('popstate', function() {
 handler.close();
  });

</script>



Jim Danz

unread,
Apr 21, 2015, 6:55:40 PM4/21/15
to api-d...@lists.stripe.com
Hey Mike,

If what you're trying to do is submit your form after Stripe Checkout
finishes, you may be able to use the "simple" rather than custom
integration:
https://stripe.com/docs/checkout#integration-simple

Have you considered if that will meet your needs?

Otherwise, in terms of debugging your current integration, Stripe
wouldn't be resetting the page. Still, there are a few things that
could be going on from the Javascript side. It'd probably be most
useful to open up the the Chrome Inspector and possibly add some
logging or other debugging hooks to try to get to the bottom of what's
going on If you'd like us to look further, perhaps you could provide
a URL where a demo version of this is hosted that we could try to
debug (feel free to respond off-list with that).

Cheers,
JIm
> --
> You received this message because you are subscribed to the Google Groups
> "Stripe API Discussion" group.
> To post to this group, send email to api-d...@lists.stripe.com.
> Visit this group at
> http://groups.google.com/a/lists.stripe.com/group/api-discuss/.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages