Creating a variable price button with the php coinbase api

731 views Asked by At

I'm using coinbase-php and have run into a problem:

I have tried so many things but I honestly don't understand how to pass options to the create button function. I noticed how they pass the description option but when I try to do the same for variable_price it does not appear to work. Here is what I tried:

$button = $coinbase->createButton("TipModel", "0.01", "USD", "", array("variable_price" => True))->embedHtml;

It still is a fixed price though.

2

There are 2 answers

1
Farkie On BEST ANSWER

If you do the choose_price option too, it seems to work. Try this:

$button = $coinbase->createButton("TipModel", "0.01", "USD", "", array("variable_price" => true, 'choose_price' => true))->embedHtml;
1
vincent kleine On

It seems to be a bug, your code seems to be correct. Some one else commented it too that the variable_price does not work in the php api.

Vladimir • a month ago

There is a problem with creating customized button with option "variable_price"=>"true" using coinbase.php class from github. Such a button does not have input field for number of btc to send. The value is fixed, no matters variable_price is set for true or false. All other custom options works good.

https://coinbase.com/api/doc/1.0/buttons/create.html