0

I would like to change the placeholder value from "Card Number" to something like 1234*****5678 in the stripe modal. How can I do that?

stripe modal

Thank you.

The modal has been generate by the below code.

<script src="https://checkout.stripe.com/checkout.js" ></script>

var handler = StripeCheckout.configure({
        key: "",
        locale: 'english',
        image: '',
        panelLabel: 'Update Card',
        token: function(token) {
          
    });
    handler.open({
       name: "sitename",
       currency: 'USD',
    
       opened: function () {
       }
    });
nice_dev
  • 17,053
  • 2
  • 21
  • 35
Refat
  • 23
  • 1
  • 7
  • 1
    The customization option is available in the latest version of Stripe. Check this https://stripe.dev/elements-examples/ and https://stripe.com/docs/js/elements_object/create – Samir Selia Jul 03 '21 at 10:25
  • 1
    Here's a complete example answered in another post https://stackoverflow.com/a/56924846/4139967 – Samir Selia Jul 03 '21 at 10:47

1 Answers1

1

Stripe Javascript creates an iFrame hosted on their own domain, so for security reasons you're not allowed to access/edit the DOM of such iFrame.

Just imagine that if this wouldn't be the case, your page could be allowed to get the credit number of the customer, which is a big nono.

Furthermore please note that you're using an outdated version of Stripe, you should look into migrating to a newer version here.

Andrea Olivato
  • 2,450
  • 1
  • 18
  • 30
  • Is there any way I can get the card number from server using customer id and put it there? – Refat Jul 03 '21 at 09:53
  • You can never get the card number as that would make your integration not PCI compliant. Have a look here: https://stripe.com/docs/security/guide – Paul Asjes Jul 05 '21 at 02:12