How to pass custom amount with Bitpay hosted checkout form?

600 Views Asked by At

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.

Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).

Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout

Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.

Thanks.

1

There are 1 best solutions below

0
On

I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:

<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>

Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!