Android Question PostString Coinbase API error

Multiverse app

Active Member
Licensed User
Longtime User
I've been trying to integrate the Coinbase API in my app for some time now.
I was able to login and get access key with OAuth using webview.

I am only having problems Sending money doc:

B4X:
curl https://api.coinbase.com/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions /
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c' \
  -d '{
    "type": "send",
    "to": "1AUJ8z5RuHRTqD1eikyfUUetzGmdWLGkpT",
    "amount": "0.1",
    "currency": "BTC",
    "idem": "9316dd16-0c05"
  }'


my code:
B4X:
    'FOR PAYMENT
    'https://developers.coinbase.com/api/v2#send-money
    Dim CBJobSendPayment As HttpJob:CBJobSendPayment.Initialize("CBJobSendPayment", Me)
    Dim mapjg As Map:mapjg.Initialize
    mapjg.Put("type", "send")
    mapjg.Put("to", strAccountID)
    mapjg.Put("amount", "0.000001")
    mapjg.Put("currency", "ETC")
    Dim jg As JSONGenerator:jg.Initialize(mapjg)

    CBJobSendPayment.PostString("https://api.coinbase.com/v2/accounts/71ebec49-82b1-5ad1-9a8d-aabb054e82be/transactions", jg.ToString)
    CBJobSendPayment.GetRequest.SetHeader("Content-Type", "application/json")
    CBJobSendPayment.GetRequest.SetHeader("Authorization", "Bearer "&access_token)
    Wait For (CBJobSendPayment) JobDone(CBJobSendPayment As HttpJob)
    If CBJobSendPayment.Success Then
        Dim jp As JSONParser:jp.Initialize(CBJobSendPayment.GetString)
        Log(jp)
    Else
        Msgbox(CBJobSendPayment.ErrorMessage, "Error in payment!")
    End If
    CBJobSendPayment.Release

I get the following error:
ResponseError. Reason: , Response: {"errors":[{"id":"param_required","message":"Required parameter missing: to"}]}

Is it something that I am doing wrong in the code?
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…