Generate Address
The create
endpoint generates a unique Bitcoin address to which the customer may send payments
You do this by making a POST
request to the Create endpoint from your server with some required annd optional parameters.
Request
- HTTP Method:
POST
- URL:
https://api.bitbata.com/v1/generate_address
The following table lists all additional POST parameters for the request:
Parameter | Required? | Description |
---|---|---|
recipients | Yes | Address(es) for forwarding recieved bitcoin |
callback | URL for callback | No |
custom | Some custom parameters | No |
This is what a sample cURL
request will look like:
curl https://api.bitbata.com/v1/generate_address
-H "Content-Type: application/json"
-d '{ "callback":"https://example.com/callback",
"custom":"",
"recipients":[{
"mraYcWoNKubjAQzMZAXtRunRyBi1aZJURu": 55,
"mfw91atZBiMcLGExAbWitsR5GHZ3g7iPwf": 45
}],
}'
-X POST
Please note: the
recipient
parameter will normally accept aJSON
type data with your wallet address as key and the percentage share as value. So, in the example request above there are 2 wallet addresses where all bitcoins forwarded to and they are set to be split at 55% and 45% respectively (excluding fees)
Success Response
- HTTP Status Code:
200
- Content Type:
application/json
The following table lists all potential properties of the JSON
object returned in the response body:
Parameter | Description? | Present |
---|---|---|
address | The generated Bitcoin address | Always |
recipient | The supplied addres(es) where bitcoin payments will be forwarded to | Always |
callback | Specified callback address | Always |
custom | Specified custom parameters params | Always |
{
"address": "mtkMv18N7KthrSGKS728PAPS5e9hPGe45G",
"receipients": {
"mraYcWoNKubjAQzMZAXtRunRyBi1aZJURu": 55,
"mfw91atZBiMcLGExAbWitsR5GHZ3g7iPwf": 45
},
"callback": null,
"custom": null
}
The above response simply states that whatever amount that is sent to
mtkMv18N7KthrSGKS728PAPS5e9hPGe45G
will be forwarded tomraYcWoNKubjAQzMZAXtRunRyBi1aZJURu
andmfw91atZBiMcLGExAbWitsR5GHZ3g7iPwf
at 55% and 45% share respectively.
Failed Response
- HTTP Status Code:
422
- Content Type:
application/json
The following table lists all potential properties of the JSON object returned in the response body:
Parameter | Required? | Description |
---|---|---|
message | Yes | General message about the error |
errors | Yes | A JSON object providing the error in details |
{
"message": "The given data was invalid.",
"errors": {
"email": ["The email field is required."],
"recipients": ["The recipients field is required."]
}
}