Package: python-blockbee
BlockBee's Python LibraryPython implementation of BlockBee's payment gatewayRequirements:Python >= 3.0
Requests >= 2.20Installpipinstallpython-blockbeeon pypioron GitHubUsageImporting in your project filefromblockbeeimportBlockBeeHelperGenerating a new AddressfromblockbeeimportBlockBeeHelperbb=BlockBeeHelper(coin,own_address,callback_url,params,bb_params,api_key)address=bb.getAddress()['address_in']Where:coinis the coin you wish to use, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...).own_addressis your own crypto address, where your funds will be sent to.callback_urlis the URL that will be called upon payment.paramsis any parameter you wish to send to identify the payment, such as{orderId: 1234}.bb_paramsparameters that will be passed to BlockBee _(check which extra parameters are available here:https://docs.blockbee.io/#operation/create).api_keyis the API Key provided by BlockBee'sdashboard.addressis the newly generated address, that you will show your users in order to receive payments.Getting notified when the user paysOnce your customer makes a payment, BlockBee will send a callback to yourcallbackUrl. This callback information is by default inGETbut you can se it toPOSTby settingpost: 1inblockbeeParams. The parameters sent by BlockBee in this callback can be consulted here:https://docs.blockbee.io/#operation/confirmedcallbackgetChecking the logs of a requestfromblockbeeimportBlockBeeHelperbb=BlockBeeHelper(coin,own_address,callback_url,params,bb_params,api_key)data=bb.get_logs()Same parameters as before, thedatareturned can b e checked here:https://docs.blockbee.io/#operation/logsGenerating a QR codefromblockbeeimportBlockBeeHelperbb=BlockBeeHelper(coin,own_address,callback_url,params,bb_params,api_key)###qr_code=bb.get_qrcode(value,size)For object creation, same parameters as before. You must first call ``getAddress` as this method requires the payment address to have been created.For QR Code generation:valueis the value requested to the user in the coin to which the request was done.Optional, can be empty if you don't wish to add the value to the QR Code.sizeSize of the QR Code image in pixels. Optional, leave empty to use the default size of 512.Response is an object withqr_code(base64 encoded image data) andpayment_uri(the value encoded in the QR), seehttps://docs.blockbee.io/#operation/qrcodefor more information.Estimating transaction feesfromblockbeeimportBlockBeeHelperfees=BlockBeeHelper.get_estimate(coin,addresses,priority,api_key)Where:coinis the coin you wish to check, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...)addressesThe number of addresses to forward the funds to. Optional, defaults to 1.priorityConfirmation priority, (checkthisarticle to learn more about it). Optional, defaults todefault.api_keyis the API Key provided by BlockBee'sdashboard.Response is an object withestimated_costandestimated_cost_usd, seehttps://docs.blockbee.io/#operation/estimatefor more information.Converting between coins and fiatfromblockbeeimportBlockBeeHelperconversion=BlockBeeHelper.get_conversion(value,from_coin,api_key)Where:cointhe target currency to convert to, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...)valuevalue to convert infrom.from_coincurrency to convert from, FIAT or crypto.api_keyis the API Key provided by BlockBee'sdashboard.Response is an object withvalue_coinandexchange_rate, seehttps://docs.blockbee.io/#operation/convertfor more information.Getting supported coinsfromblockbeeimportBlockBeeHelpersupportedCoins=BlockBeeHelper.get_supported_coins(api_key)Where:api_keyis the API Key provided by BlockBee'sdashboard.Response is an array with all supported coins.Request PayoutfromblockbeeimportBlockBeeHelperpayout=BlockBeeHelper.create_payout(coin,address,value,apiKey)This function can be used by you to request payouts (withdrawals in your platform).Where:coinThe cryptocurrency you want to request the Payout in (e.gbtc,eth,erc20_usdt, ...).addressAddress where the Payout must be sent to.valueAmount to send to theaddress.api_keyis the API Key provided by BlockBee'sdashboard.The response will be only asuccessto confirm the Payout Request was successfully created. To fulfill it you will need to go to BlockBee Dashboard.HelpNeed help?Contact us @https://blockbee.io/contacts/Changelog1.0.0Initial Release1.0.1Minor fixes1.0.2Minor fixes1.0.3Fix importMinor fixes1.1.0Added PayoutsMinor bugfixes