Bitcoin Forum
November 08, 2024, 07:17:32 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Payments through instawallet API  (Read 1093 times)
Bart (OP)
Newbie
*
Offline Offline

Activity: 54
Merit: 0


View Profile
May 02, 2012, 01:15:07 AM
 #1

Quote
HTTP POST https://www.instawallet.org/api/v1/w/<wallet_id>/payment
Initiates a payment. Your request needs to include the parameters "address" and "amount". Amount should be in Bitcoin base units (Satoshis). The optional parameter "use_green_address" can be passed with a value of "true" to use the green address feature.
Example response: {"successful": true, "message": "Sent 0.01 BTC to 14Z1mazY4HfysZyMaKudFr63EwHqQT2njz", "message_code": 0}

https://www.instawallet.org/static/api.html

I did not understand where and how I insert the parameters "address and "amount".

An example:

In this instawallet (naturally empty) https://www.instawallet.org/w/3rvuZQWvVnl5wvxoXARWMsKja3ooB3A the wallet_id is 3rvuZQWvVnl5wvxoXARWMsKja3ooB3A, not 1Goezou3Z18nimVobARq6pNo4noLxgBsuN, which is the address to send bitcoins to this wallet.

Using API in this wallet:
https://www.instawallet.org/api/v1/w/3rvuZQWvVnl5wvxoXARWMsKja3ooB3A/address (bitcoins address: 1Goezou3Z18nimVobARq6pNo4noLxgBsuN) ok

https://www.instawallet.org/api/v1/w/3rvuZQWvVnl5wvxoXARWMsKja3ooB3A/balance (balance = 0.0 bitcoins) ok

Let's say this instawallet is not empty and I want to send 0.1 bitcoin to the instawallet RXDS0myl8EFyDO2N8prYm8gAiTMUrJvtQ, which the address to receive bitcoins is: 17vuGAioA6Bah5HEznEFmNuzfSDQyiNt4t

So, through API, would be:
https://www.instawallet.org/api/v1/w/3rvuZQWvVnl5wvxoXARWMsKja3ooB3A/payment HuhHuhHuhHuh Where do I insert the parameters 17vuGAioA6Bah5HEznEFmNuzfSDQyiNt4t+0.1 into this url?

And if you want to use green address, how to do that?
Tuxavant
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1010

Bitcoin Mayor of Las Vegas


View Profile WWW
May 02, 2012, 02:54:11 AM
 #2

A post requires the information to be in the HTML header, not the query string. Use a tool like curl to add the address and amount fields to the header.

Code:
-d, --data <data>
              (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that  a  browser
              does  when  a  user  has filled in an HTML form and presses the submit button. This will cause curl to
              pass the data to the server using the content-type application/x-www-form-urlencoded.  Compare to  -F,
              --form.

              -d, --data is the same as --data-ascii. To post data purely binary, you should instead use the --data-
              binary option. To URL-encode the value of a form field you may use --data-urlencode.

              If any of these options is used more than once on the same command line,  the  data  pieces  specified
              will  be merged together with a separating &-symbol. Thus, using '-d name=daniel -d skill=lousy' would
              generate a post chunk that looks like 'name=daniel&skill=lousy'.

              If you start the data with the letter @, the rest should be a file name to read the data from, or - if
              you want curl to read the data from stdin.  The contents of the file must already be URL-encoded. Mul‐
              tiple files can also be specified. Posting data from a file named 'foobar' would  thus  be  done  with
              --data @foobar.

andrehorta
Legendary
*
Offline Offline

Activity: 1261
Merit: 1000


View Profile WWW
May 17, 2012, 06:20:11 PM
 #3

Hi

When ai call:

https://www.instawallet.org/api/v1/w/ZJA1jrNoWTFahQ7txYtkmd0zvS3UH3p6fA/payment

Parameters:
address: 1AoACLLonFM4nRxGqaTrmJN3y1pYnXXg9j
amount: 0.01

Error message: "Sorry, I was not able to parse the amount field."


What is the correct format to send the Amount?

Return:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.11
Strict-Transport-Security: max-age=31536000
X-UA-Compatible: IE=Edge,chrome=1
ETag: "13705d7997a434b4565ccbc0117d2592"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _instawallet_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTk2ZGQ5Nzc1YTg5NDkzZjBmMWYyMTdiYmY4ZDViNTcwBjsAVA%3D%3D--de05b1f5a9620ac2fef0cb09b3e72173c08f92db; path=/; secure; HttpOnly
X-Request-Id: dbe74c5f5883aad257c294ef064651ee
X-Runtime: 0.007287
Date: Thu, 17 May 2012 18:18:06 GMT
X-Rack-Cache: invalidate, pass
Server: nginx/1.0.15 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)

{
  "successful": false,
  "message_code": 5,
  "message": "Sorry, I was not able to parse the amount field."
}
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!