I'll do the best I can!
Before I jump into the API stuff, though, I just want to point out that uou can generate a checkout button or page with Coinbase's Merchant Tools. Simply click "Merchant Tools" on the left hand side menu. Also see
https://coinbase.com/docs/merchant_tools/payment_buttonsThe documentation explains "For more advanced integrations, it's sometimes necessary to create many buttons with different prices. In these cases you'll want to use the buttons API." If that's what you need:
Buttons can be embedded in a page using some embed code. There are a couple of other options like button size that you can use, but this is the template for a basic Coinbase Buy button:
Firstly, we'll need an API key to tell Coinbase who we are when we're asking them to create a button for us. Go to
https://coinbase.com/account/integrations and enable and generate an API key.
Secondly, you'll notice that there's this "code", 4d4b84bbad4508b64b61d372ea394dad. This is what tells Coinbase what you're selling and makes your button unique. To create a new code, we need to send an HTTP Post request to
https://coinbase.com/api/v1/buttonsYou can use HURL to test creating one:
http://www.hurl.it/Type in
https://coinbase.com/api/v1/buttons?api_key=[YOUR_API_KEY_HERE} and select "POST". POST requests typically *create* data, where as GET requests *get* data. You'll want to pass in some params, as the documentation outlines. To do this, click "add param" in Hurl and try adding different params that the documentation explains. button[name], button[price_string], and button[price_currency_iso] are all required.
Here's an example of what it should look like:
https://i.imgur.com/gqvWNcI.pngThe response is going to be JSON (JavaScript Object Notation), which is an object that contains a bunch of attributes and corresponding values. The most important one we're concerned with is the "code". This is going to replace "4d4b84bbad4508b64b61d372ea394dad" in the above example. So in my example, the embed code would be:
A word of caution about using the API: Never let anybody know your API key. If you'd like to create new buttons on the fly, always do it "out of band". That is, have your web server make the request, NOT the user.
Hope that helps!