WalletBit/API: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
WalletBit (talk | contribs)
Created page with "Three APIs are currently available: * Sent API * Getnewaddress API * Lookup API ===Sent to..."
 
Imsaguy (talk | contribs)
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Three APIs are currently available:  
The following information may no longer be true, WalletBit service was suspended
See https://bitcointalk.org/index.php?topic=249751.new
The article is kept only as historic documentation.


* [[WalletBit/API/Sent|Sent API]]  
Four APIs are currently available:
 
* [[WalletBit/API/Send|Send API]]
* [[WalletBit/API/SendTo|SendTo API]]  
* [[WalletBit/API/Getnewaddress|Getnewaddress API]]  
* [[WalletBit/API/Getnewaddress|Getnewaddress API]]  
* [[WalletBit/API/Lookup|Lookup API]]
* [[WalletBit/API/Lookup|Lookup API]]


===Sent to Email or Bitcoin address===
===Send to Email or Bitcoin address===


<source lang="php">
<source lang="php">
Line 34: Line 40:


If 'customer_email' is not on WalletBit, it will try to send to the defined bitcoin address.
If 'customer_email' is not on WalletBit, it will try to send to the defined bitcoin address.
===Send to Email or Mobile number (SMS)===
<source lang="php">
$fields = array(
  'merchant' => 'owner@example.com', // Requires a valid WalletBit account with API key.
  'to' => '4550142790', // Email or Mobile number
  'from' => '4591614856', // Email, Name or Phone number
  'details' => 'You got Bitcoins!' // Message to recipient
);
$fields['encrypted'] = strtoupper(hash('sha256', $fields['merchant'] . ':' . $fields['to'] . ':' . $fields['from'] . ':' . 'API Key'));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://walletbit.com/api/sendto');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = json_decode(curl_exec($ch));
curl_close($ch);
if (is_object($response))
{
    // everythings good
    if ($response->status == 1)
    {
        // any bitcoin sent to this address will be forwarded
        print $response->address;
    }
    else
    {
        // print error message
        print $response->message;
    }
}
</source>
==Send Bitcoin Methods==
Parameters:<br />
Merchant - WalletBit email<br />
To *    - The recipient's email address or mobile phone number (712 mobile networks in 212 countries)<br />
From    - The sender's name, phone number or email address<br />
Details  - Optional details to include. (22 characters message limit on phone messages)<br />
* Numbers MUST be in their international format, (no leading zeroes). The UK number 0870 711 111 will become 44870711111<br /><br />
Return:<br />
Status  - Indicating if the transaction was successful by a one or zero.<br />
Message  - Response from sendTo containing possible errors or similar.<br />
Address  - A Bitcoin address. Send bitcoins to it, and it will be forwarded immediately.<br />
When bitcoin is sent to the generated bitcoin address, the system will send out IPN to the defined url in your account.<br />
Our sendTo system covers 712 mobile networks in 212 countries — we can reach almost all mobile phones, however please test if we can reach your mobile or the mobile you want to send to, prior to utilize sending bitcoin via SMS. If the mobile is not covered, you can still enjoy sending instant to email addresses with WalletBit.


===Generate new Bitcoin address===
===Generate new Bitcoin address===
Line 56: Line 121:


If successful $response will contain your new bitcoin address, otherwise empty.
If successful $response will contain your new bitcoin address, otherwise empty.


===Lookup deposit to Bitcoin address===
===Lookup deposit to Bitcoin address===
Line 77: Line 144:
</source>
</source>


If successful $response returns a json encoded array containing amount, confirmations, txid and timestamp of deposit to the provided Bitcoin address, otherwise empty.
If successful $response returns a json encoded array containing batch number, amount, fee, confirmations, txid, address and timestamp of deposit to the provided Bitcoin address, otherwise empty.

Latest revision as of 16:01, 6 April 2014

The following information may no longer be true, WalletBit service was suspended
See https://bitcointalk.org/index.php?topic=249751.new

The article is kept only as historic documentation.

Four APIs are currently available:

Send to Email or Bitcoin address

$fields = array(
  'merchant' => 'owner@example.com',
  'customer_email' => 'johnsmith@example.com',
  'address' => '',
  'amount' => 0.01000000,
  'details' => 'You got Bitcoins!'
);
$fields['encrypted'] = strtoupper(hash('sha256', $fields['merchant'] . ':' . $fields['customer_email'] . ':' . $fields['amount'] . ':' . 'API Key'));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://walletbit.com/api');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = curl_exec($ch);
curl_close($ch);

if ($response == '1')
{

}

If 'customer_email' is not on WalletBit, it will try to send to the defined bitcoin address.


Send to Email or Mobile number (SMS)

$fields = array(
  'merchant' => 'owner@example.com', // Requires a valid WalletBit account with API key.
  'to' => '4550142790',	// Email or Mobile number
  'from' => '4591614856', // Email, Name or Phone number
  'details' => 'You got Bitcoins!' // Message to recipient
);
$fields['encrypted'] = strtoupper(hash('sha256', $fields['merchant'] . ':' . $fields['to'] . ':' . $fields['from'] . ':' . 'API Key'));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://walletbit.com/api/sendto');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = json_decode(curl_exec($ch));
curl_close($ch);

if (is_object($response))
{
    // everythings good
    if ($response->status == 1)
    {
        // any bitcoin sent to this address will be forwarded
        print $response->address;
    }
    else
    {
        // print error message
        print $response->message;
    }
}

Send Bitcoin Methods

Parameters:
Merchant - WalletBit email
To * - The recipient's email address or mobile phone number (712 mobile networks in 212 countries)
From - The sender's name, phone number or email address
Details - Optional details to include. (22 characters message limit on phone messages)

  • Numbers MUST be in their international format, (no leading zeroes). The UK number 0870 711 111 will become 44870711111

Return:
Status - Indicating if the transaction was successful by a one or zero.
Message - Response from sendTo containing possible errors or similar.
Address - A Bitcoin address. Send bitcoins to it, and it will be forwarded immediately.

When bitcoin is sent to the generated bitcoin address, the system will send out IPN to the defined url in your account.

Our sendTo system covers 712 mobile networks in 212 countries — we can reach almost all mobile phones, however please test if we can reach your mobile or the mobile you want to send to, prior to utilize sending bitcoin via SMS. If the mobile is not covered, you can still enjoy sending instant to email addresses with WalletBit.


Generate new Bitcoin address

$fields = array(
  'merchant' => 'owner@example.com',
  'label' => 'TEST'
);
$fields['encrypted'] = strtoupper(hash('sha256', $fields['merchant'] . ':' . $fields['label'] . ':' . 'API Key'));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://walletbit.com/api/getnewaddress');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = curl_exec($ch);
curl_close($ch);

If successful $response will contain your new bitcoin address, otherwise empty.


Lookup deposit to Bitcoin address

$fields = array(
  'merchant' => 'owner@example.com',
  'address' => '1BPeF1tGHQj1tHoyZkFps1QKCbnqdx2yHE'
);
$fields['encrypted'] = strtoupper(hash('sha256', $fields['merchant'] . ':' . $fields['address'] . ':' . 'API Key'));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://walletbit.com/api/lookup/deposit');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$response = curl_exec($ch);
curl_close($ch);

If successful $response returns a json encoded array containing batch number, amount, fee, confirmations, txid, address and timestamp of deposit to the provided Bitcoin address, otherwise empty.