4m1nh4j1
4m1nh4j1

Reputation: 4356

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>

enter image description here

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>  

enter image description here

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

Do you have any idea how to do it ?

Upvotes: 0

Views: 1415

Answers (1)

Sletheren
Sletheren

Reputation: 2478

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 }

Upvotes: 4

Related Questions