Search code examples
javascriptiframebitcoincoinbase-api

Coinbase accepting BTC - pre-populate an amount for iframe


Is there a way of showing a Coinbase iframe with an amount pre-populated (instead of allowing the user to change the amount in the iframe)? Ideally I'd like the ability for the user to enter in an amount before he/she clicks on a 'pay with bitcoin' button.

I know this can probably done by calling the API to regenerate a new iframe when the user clicks a button but I'd rather not do that each time a button is clicked.


Solution

  • When you'd like to create payment buttons or iFrames with a static amount, it's typically easiest to just create a new one for each transaction. If you'll only be using each iFrame once, you can create a new one with just one API endpoint: https://developers.coinbase.com/api#create-an-order-for-a-button

    I'd recommend also taking a look at the Coinbase client libraries (https://developers.coinbase.com/api#api-client-libraries); they can greatly simplify the integration process. The API support team can also be reached at [email protected].

    Hope that helps; happy to answer any additional questions that come up.