bitpay hosted checkout button integration

185 Views Asked by At

I was trying to process bitcoin payments thru my website using bitpay. The problem is that I cannot pass the total amount from the cart to bitpay button in order to charge the customer the right amount. I know there is a way to do that since bitpay mention that in their website and I already emailed their support and waiting for an answer but wanna integrate the button earlier since they take some time to answer. If someone is using bitpay or have faced the same problem, please let me know. Your help will be appreciated. Thanks.

1

There are 1 best solutions below

0
On

Not sure if this has been answered yet, but I found this question while looking for the same answer, and found it later to help my project with implementing a BitPay button for a shopping cart:

<form action="https://test.bitpay.com/checkout" method="post">
   <input type="hidden" name="action" value="checkout" />
   <input type="hidden" name="posData" value="" />
   <input type="hidden" name="price" value="<?php echo $price_var;?>" />
   <input type="hidden" name="data" value="...(your data value)..." />
   <input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
 </form>

The Bitpay site does not tell you how to set a custom price, but if you have it stored as a global variable (for example, $price_var above), you can use the line above that contains name="price" to set a custom price.