Authenticated resource that creates a payment button, page, or iFrame to accept bitcoin on your website. This can be used to accept bitcoin for an individual item or to integrate with your existing shopping cart solution. For example, you could create a new payment button for each shopping cart on your website, setting the total and order number in the button at checkout.
The code param returned in the response can be used to generate an embeddable button, payment page, or iFrame. Coinbase stores the underlying model in the same way, so the code can be used to generate any of these payment methods. Click one of the links above to see sample code showing how the code parameter is used.
You can set a variety of options on payment buttons. These correspond to the options used on the button generator page.
These include type, style, custom, variable_price, include_email, include_address, custom redirect urls, and more. For a description of each of these see the documentation below.
# Request
POST /api/v1/buttons
{
"button": {
"name": "test",
"type": "buy_now",
"price_string": "1.23",
"price_currency_iso": "USD",
"custom": "Order123",
"callback_url": "http://www.example.com/my_custom_button_callback",
"description": "Sample description",
"type": "buy_now",
"style": "custom_large",
"include_email": true
}
}
# Reponse
{
"success": true,
"button": {
"code": "93865b9cae83706ae59220c013bc0afd",
"type": "buy_now",
"style": "custom_large",
"text": "Pay With Bitcoin",
"name": "test",
"description": "Sample description",
"custom": "Order123",
"callback_url": "http://www.example.com/my_custom_button_callback",
"price": {
"cents": 123,
"currency_iso": "USD"
}
}
}
| Param name | Description |
|---|---|
|
button required |
Button object containing the following params Value: Must be a Hash |
|
button[name] required |
The name of the item for which you are collecting bitcoin. For example, Value: Must be String |
|
button[price_string] required |
Price as a decimal string, for example Value: Must be String |
|
button[price_currency_iso] required |
Price currency as an ISO 4217 code such as Value: Must be String |
|
button[type] optional |
One of Value: Must be String |
|
button[style] optional |
One of Value: Must be String |
|
button[text] optional |
Allows you to customize the button text on Value: Must be String |
|
button[description] optional |
Longer description of the item in case you want it added to the user’s transaction notes. Value: Must be String |
|
button[custom] optional |
An optional custom parameter. Usually an Order, User, or Product ID corresponding to a record in your database. Value: Must be String |
|
button[callback_url] optional |
A custom callback URL specific to this button. It will receive the same information that would otherwise be sent to your Instant Payment Notification URL. If you have an Instant Payment Notification URL set on your account, this will be called instead — they will not both be called. Value: Must be String |
|
button[success_url] optional |
A custom success URL specific to this button. The user will be redirected to this URL after a successful payment. It will receive the same parameters that would otherwise be sent to the default success url set on the account. Value: Must be String |
|
button[cancel_url] optional |
A custom cancel URL specific to this button. The user will be redirected to this URL after a canceled order. It will receive the same parameters that would otherwise be sent to the default cancel url set on the account. Value: Must be String |
|
button[info_url] optional |
A custom info URL specific to this button. Displayed to the user after a successful purchase for sharing. It will receive the same parameters that would otherwise be sent to the default info url set on the account. Value: Must be String |
|
button[variable_price] optional |
Allow users to change the price on the generated button. Value: Must be Boolean |
|
button[choose_price] optional |
Show some suggested prices Value: Must be Boolean |
|
button[include_address] optional |
Collect shipping address from customer (not for use with inline iframes). Value: Must be Boolean |
|
button[include_email] optional |
Collect email address from customer (not for use with inline iframes). Value: Must be Boolean |
|
button[price1] optional |
Suggested price 1 Value: Must be String |
|
button[price2] optional |
Suggested price 2 Value: Must be String |
|
button[price3] optional |
Suggested price 3 Value: Must be String |
|
button[price4] optional |
Suggested price 4 Value: Must be String |
|
button[price5] optional |
Suggested price 5 Value: Must be String |