How do I configure the PHP BitPay Client Library?
5 stars based on
67 reviews
Have you ever thought about selling your services in exchange for Bitcoins? Also, some countries are thinking about it as a currency. Coinbase has some interesting tools and SDKs available for everyone, with some pricing conditions that are convenient and affordable.
Really cool if you want to avoid the currency instability and transfer your money as soon as you can. Just like many other online payment services, Coinbase offers two main ways of integration into your web app.
The first one is faster and easier. The second one is a little more difficult, but also goes into more depth and is adequate for a bigger project. The first integration type consists of using one of the Merchant Tools that Coinbase makes available. You can use buttonspages and frames. The second, of which we will see an example today, is a complete integration of the service without going to the Coinbase website to generate some standard button code.
At this moment, there are accept bitcoin payments php array SDKs available: There are also many unofficial libraries for other languages Python. Coinbase has accept bitcoin payments php array ways to authenticate you as a developer in order to access accept bitcoin payments php array API methods. Or, if you want, you can use OAuth 2. The difference is not only about complexity, but also about the situation you have to deal with. The Coinbase documentation is quite clear: If you want to let the user use his account through your app a client you build, for examplethe best thing is to use OAuth.
For your first time, you will probably have to confirm your account accept bitcoin payments php array Authy. You will have to specify the account you want to use and what permissions you want to assign to that specific key, in order to gain access. Also, you can choose one or more IPs to use as a whitelist. If you want to use OAuth 2. To do that, go to https: You will see a accept bitcoin payments php array like this one:. Insert your application name, choose an icon if you want and specify a list of URLs for future redirect operations.
Everything else will be ignored. Give your OK and you are done! Things are not over, however: If you work with the API you will have to deal with permissions, for better security. Here you can see a complete list:. Now that we have our SDK included in our project, our access set up, and we know what we need, it is time to start.
Just like this example:. After the user completes the authorization process he will be redirected to the URL specified before, during the setup. A code parameter will accept bitcoin payments php array be added to get a valid token.
Accessing to your data is quite easy. The getCurrencies method returns a list of all the currencies actually active on the system, with their ISO codes. The getExchangeRate can be used both with and without parameters with two different results, as accept bitcoin payments php array can see.
You can also get some information about the buy and sell prices with getBuyPrice and getSellPrice:. The payment button creation method is really useful, if you consider the implementation difficulty and the final result. All you have to do is to call the createButton method with a specific set of parameters. If you want to know more about that, I suggest you to take a look at the dedicated page on the official documentation.
Francesco is a web developer and accept bitcoin payments php array from Italy. IT, the first italian web development portal.
He also translated some books about Laravel. In the meantime he follows other projects, works as a freelance backend consultant for PHP applications and studies IT Engineering in Rome. He loves to learn new things, not only about PHP or development but everything. He hopes to work for IBM, sooner or later.