Documentation

Quick start

As Biwse is developer friendly platform it's easy to start creating amazing stuff. In this article you will get through registration to working solution and trust us - it's realy under 5 minutes.

You need to sign up for a Biwse account to get started.

Step 1: API Token

Once you have account registered you can create application. Appliaction is your bitcoin wallet which you can access via our API. You can create as many appliacitons as you want to power different projects. API token is application specific, so this allows you to manage tokens across your projects more easily.

You can create new token on application page.

Note: Save token in a safe place, it allows you access Biwse API and spend funds.

Tip: You can perform API requests with test token test_token_I6Ims4a2dvNXJLUzMy and it will give you responses with test data.

Step 2: Invoice page

With your API token you can generate new address:

Example Request:

                                
curl -X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
https://biwse.com/api/v1/new_address

# Response:
# {"status": true, "address": "YOUR_NEW_ADDRESS"}
                            

Use generated address to create invoice page. Also you need to specify amount that you want to receive:

Example Request:

                                

curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"address": "ADDRESS",
"amount": 0.001
}' \
https://biwse.com/api/v1/new_invoice

# Response:
#{"status":true,"id":"invoice_id...","url":"https://biwse.com/invoice/invoice_id..."}
                            

You can visit link from response and see your invoice page is ready to work!

What next?
Biwse PHP Client

The Biwse PHP library provides access to the Biwse API.

Install the package with:


composer require biwse/biwse-php
                            

The package needs to be configured with your application access token which is available in your Biwse Dashboard.

Configure client:


use Biwse\Client\Biwse;
// create API client using your token
$app = new Biwse("YOUR_TOKEN");
                            
Get balance

$res = $app->balance();
$total = $res->total;
$confirmed = $res->confirmed;
                            
New address

$res = $app->newAddress("https://your_cllback_link.com");
$address = $res->address;
                            
Send money

$res = $app->send("ADDRESS",0.001);
$txHash = $res->tx_hash;
                            
Multi send money

$res = $app->multiSend([ "payments" =>[
            ["address" => "ADDRESS_1","amount" => 0.001],
            ["address" => "ADDRESS_2","amount" => 0.001],
        ]
    ]);
$txHash = $res->tx_hash;
                            
New invoice

$res = $app->newInvoice("YOUR_ADDRESS",0.1);
$invoiceUrl = $res->url;
                            
Biwse JS Client

The Biwse JS library provides access to the Biwse API.

Install the package with:


npm install biwse-js --save
                            

The package needs to be configured with your application access token which is available in your Biwse Dashboard.

Configure client:


import BiwseAPI from 'biwse-js' 
// create API client using your token
const app = new BiwseAPI('your_token...')
                            
New address

You can omit callback argument (see API reference).


const { address, status } = await app.newAddress('https://your_address...')
                            
New invoice

const response = await app.newInvoice('btc_address...', 0.001)
const { status, id, url } = response
                            
Get balance

const response = await app.balance()
const { total, confirmed, status } = response
                            
Send money

const { tx_hash, status } = await app.send('btc_address...', 0.001)
                            
Multi send money

const { tx_hash, status } = await app.multiSend({payments: [
	{address: 'btc_address_1', amount: 0.001},
	{address: 'btc_address_2', amount: 0.001},
]})
                            
How to start

Firstly, you will need your API-key which we provide for bitcoin wallets. You can get the keys in the settings of your application. You have to use the API-key in interaction with biwse.com. All the requests have to contain these headers:

Content-Type:application/json
Accept:application/json
Authorization:Bearer YOUR_TOKEN

YOUR_TOKEN – the key you received in the App settings.


Getting an application balance
Request type:GET
URL:/api/v1/balance

To receive the balance you have to send a GET request to this address - https://biwse.com/api/v1/balance

Example Request:

                                
curl -X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
https://biwse.com/api/v1/balance
                            

In response to the request you receive JSON with the following content:

Example Response:

                                
{
    "status": true,
    "total": 0.5,
    "confirmed": 0.5
}
                            

total – Total balance amount;
confirmed - Confirmed balance amount;


Getting new address
Request type:GET|POST
URL:/api/v1/new_address

To receive the bitcoin address you have to send a GET request to this address - https://biwse.com/api/v1/new_address

Example Request:

                                
curl -X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
https://biwse.com/api/v1/new_address
                            

In response to the request you receive JSON with the following content:

Example Response:


{
    "status": true,
    "address": "YOUR_NEW_ADDRESS"
}

If you want to receive notifications about crediting funds to the address, then send a POST request to this address - https://biwse.com/api/v1/new_address

Example Request:

                                
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"callback_link": "https://yoursite.com",
}' \
https://biwse.com/api/v1/new_address
                            

callback_link - is your unique URL address which will receive a POST request about crediting funds with the following content:

                                    
{
    "amount":  0.1,
    "confs": 1,
    "address": "ADDRESS",
    "tx_hash": "TX_HASH",
    "verification_hash": "md5(SECRET_KEY.ADDRESS)"
}
                                

amount – Payment amount;
confs – Is the number of confirmed transactions;
address – The address to which the funds were received;
tx_hash – Transaction hash in bitcoin network;
verification_hash – Is our unique hash for verifying the authenticity of the request;
SECRET_KEY – Is your application secret key. Don’t confuse it with Token.

We will send you notifications until the payment gets six confirmations. We will stop sending you notifications if for another request we receive a JSON Response Format with the following content:


{
    "accepted": true
}

In this case, our system will consider that your payment is accepted.


Sending money
Request type:POST
URL:/api/v1/send

In order to send bitcoin funds from your wallet you have to send a POST request to this address - https://biwse.com/api/v1/send

Example Request:


curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"address": "ADDRESS",
"amount": 0.001
}' \
https://biwse.com/api/v1/send

If the transaction is successful, you will receive JSON in response to the request with the following content:

Example Response:


{
    "status": true,
    "tx_hash": "TX_HASH"
}
                                

tx_hash – transaction hash in bitcoin network;

If you need to send multiple payments in one transaction you have to send a POST request to this address https://biwse.com/api/v1/multi_send

Example Request:


curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
        "payments":[
            {
                "address": "YOUR_ADDRESS_1",
                "amount": 0.001
            },
            {
                "address": "YOUR_ADDRESS_2",
                "amount": 0.001
            }
        ]
}' \
https://biwse.com/api/v1/multi_send

The maximum number of allowed addresses for one transaction is 100.


Create an invoice page
Request type:POST
URL:/api/v1/new_invoice

Invoice is a payment receipt page.

You have got all the necessary data to create your invoice page, but if you want to use our invoice page you have to send a POST request to this address - https://biwse.com/api/v1/new_invoice

Example Request:


curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"address": "ADDRESS",
"amount": 0.001
}' \
https://biwse.com/api/v1/new_invoice

address - is your address where you want to receive payments;
amount – payment amount.

In response to the request you receive JSON with the following content

Example Response:


{
    "status": true,
    "id": "HASH",
    "url": "https://biwse.com/invoice/HASH"
}

url - is a payment page address ( the page is available within 2 hours);
id - is a unique payment identifier.

The invoice is available within an 2 hours after you created it.