Its quite long time i havent blog bout work
Recently was working out with bitpay api. Below are the rules that must follow
1. create separate key (private and public) for testnet and livenet
2. create also separate sin for testnet and livenet (this must be generate by using each own key)
3. create separate token for testnet and livenet and must immediately pairing the token on website:
testnet = https://test.bitpay.com/dashboard/merchant/api-tokens
livenet = https://bitpay.com/dashboard/merchant/api-tokens
4. Now you ready to have api connection to any action.
To work with bitpay/bitcoin, please always download their latest version of library: as my case in php
Place it in anywhere in you public_html or project folder in localhost.
In my case, i create separate class to call the library. and another php file to call this class.
For the step of 1,2 and 3 above you can follow these:
Name of the file same as the step. Step 1 follow 001.php and goes on...
Example error message:
1. Unauthorized sin - This mean, the combination of public key,private key, sin and token are wrong. Eg: testnet private key for livenet token.. this so wrong.
1. From library when there is an error, it will just blank page. This in my case, not sure about others. Solution or the cause of the issue is here:
throw new \Exception($error_message);
throw new \Exception('Error with request: no data returned');
So instead of throw error. i just put return the error message. Eg:
2. when create a token, use this array:
'label' => 'Payout Facade',
'facade' => 'payroll',
'id' => $this->sin,
You dont need to pass the pairingcode, as it will generated when u run this function. And please include the facade that you need it for.
3. To create dummy testnet and livenet bitcoin address, you can try use this website. You can create as many as you want.
Step: dashboard > crate fowarding addresses > "Address to foward to" (use the same from "Destination Address"), Network (Bitcoin Testnet for testnet) > click button "create address" > done.
4. To test the postback or IPN, use Fiddler2 (need to download this). Inside it go to tab "Composer" > put ur url of the postback (notificationURL), and the "Request body" put the example responce from them > then click Execute button > Done
Pretty much that it.. im still in the middle of developing it.. still strunggle... above are still in theory.. hope it succeed. Wish me luck!
Keyword: Bitcoin API, Bitpay API, createToken, createPayout, deletePayout, Batch Payout.