简体   繁体   中英

Custom Stripe Button

I have a static website. This is the default button in my website, and it looks pretty well, so I'd like to keep it and integrate Stripe.

        <a class="btn btn-xl btn-primary w-250" href="#">Order Now <strike>$50</strike><span class="pl-4">$30</span></a><br>

在此处输入图片说明

This is the stripe code I'm using:

                <form action="your-server-side-code" method="POST" >
                  <script
                    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                    data-key="xxxx"
                    data-amount="35000"
                    data-name="website.com"
                    data-description="my packag"
                    data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                    data-locale="auto"
                    data-zip-code="false"
                    data-label="Buy Now">   
                  </script>
                </form>  

在此处输入图片说明

I would like to make the stripe button looks like the native button.

Do you have any idea how to do it ?

Try this hack, instead of having a <a> replace it with a button and when clicked it will submit the Stripe default button ;)

            <form action="your-server-side-code" method="POST" >
              <script
                src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                data-key="xxxx"
                data-amount="35000"
                data-name="website.com"
                data-description="my packag"
                data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                data-locale="auto"
                data-zip-code="false"
                data-label="Buy Now">   
              </script>
              <button class="btn btn-xl btn-primary w-250" type="submit">Order Now <strike>$50</strike><span class="pl-4">$30</span></button><br>

            </form>  

And in your css hide the default button:

.stripe-button-el { display: none }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM