[Django]-Stripe 'card-element' isn't visible (Python/Django)

2👍

I figured it out. Leaving it here for other dummies like me.

Do not add the .js file to the top of the page. Add it to the bottom, after the /body tag. Turns out values will be NULL if the javascript loads before the page.

0👍

The Python code looks correct, at least it looks like mine does in my working integration using Django. So here’s a couple of things to try:

  1. You don’t need the clientSecret until you use stripe.confirmCardPayment() so don’t fetch it yet.
  2. Try putting the data-secret="{{client_secret}}" on the <form> element. You’ll need to add an events listener to the <form>‘s "submit" event anyway to prevent the default submission and trigger the confirmation so might as well retrieve the client_secret then.

I know this doesn’t answer why the button was no selectable but at least it gives you some next steps.

👤RyanM

Leave a comment