Bitcoin Forum
April 23, 2024, 11:19:25 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with Coinbase.com API - Please =)  (Read 5142 times)
IveGotaHunch (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0



View Profile WWW
April 04, 2013, 04:54:26 AM
 #1

I am trying to figure out how to create a simple function with a payment button from coinbase.com but need help figure out how to use the API to do this. It says it can be done in their documentation but I don't know anything about this stuff. Would love some help if someone is free. Shouldn't take but a few minutes. 
1713871165
Hero Member
*
Offline Offline

Posts: 1713871165

View Profile Personal Message (Offline)

Ignore
1713871165
Reply with quote  #2

1713871165
Report to moderator
1713871165
Hero Member
*
Offline Offline

Posts: 1713871165

View Profile Personal Message (Offline)

Ignore
1713871165
Reply with quote  #2

1713871165
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713871165
Hero Member
*
Offline Offline

Posts: 1713871165

View Profile Personal Message (Offline)

Ignore
1713871165
Reply with quote  #2

1713871165
Report to moderator
1713871165
Hero Member
*
Offline Offline

Posts: 1713871165

View Profile Personal Message (Offline)

Ignore
1713871165
Reply with quote  #2

1713871165
Report to moderator
IveGotaHunch (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0



View Profile WWW
April 05, 2013, 02:11:43 AM
Last edit: April 05, 2013, 02:29:28 AM by IveGotaHunch
 #2

Anyone with a few minutes to spare? I know nothing about coding. Wondering how to send info to coinbase api to generate the button I have code for.

here is there documentation https://coinbase.com/api/doc/buttons/create.html
eric7
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
April 05, 2013, 03:11:22 PM
Last edit: April 05, 2013, 03:54:00 PM by eric7
 #3

I'll do the best I can! Wink

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_buttons

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

Code:
<a class="coinbase-button" data-code="4d4b84bbad4508b64b61d372ea394dad" href="https://coinbase.com/checkouts/4d4b84bbad4508b64b61d372ea394dad">Pay With Bitcoin</a>
<script src="https://coinbase.com/assets/button.js" type="text/javascript"></script>

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

You 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.png

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

Code:
<a class="coinbase-button" data-code="2ecbe87514b75571aa4e09983ebdfb90" href="https://coinbase.com/checkouts/2ecbe87514b75571aa4e09983ebdfb90">Pay With Bitcoin</a>
<script src="https://coinbase.com/assets/button.js" type="text/javascript"></script>

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! Smiley
IveGotaHunch (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0



View Profile WWW
April 06, 2013, 01:33:05 AM
 #4

Eric thank you so so much that was what I needed. Now to figure out how to include value="%[PAY_AMOUNT]%" into the price section to replace the button[price_string] so it can create the price that is dynamically created before they click the buy button. I am one step closer so thank you.
eric7
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
April 09, 2013, 08:32:12 PM
 #5

Eric thank you so so much that was what I needed. Now to figure out how to include value="%[PAY_AMOUNT]%" into the price section to replace the button[price_string] so it can create the price that is dynamically created before they click the buy button. I am one step closer so thank you.

No problem! Glad I could help.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!