How to receive Json callback

0 votes

I am trying to use Coinbase's API (https://coinbase.com/api/doc) to receive callbacks to my site after a bitcoin payment. 

Coinbase's example callback is:

{
"order": {
    "id": "5RTQNACF",
    "created_at": "2012-12-09T21:23:41-08:00",
    "status": "completed",
    "total_btc": {
        "cents": 100000000,
        "currency_iso": "BTC"
    },
    "total_native": {
        "cents": 1253,
        "currency_iso": "USD"
    },
    "custom": "order1234",
    "receive_address": "1NhwPYPgoPwr5hynRAsto5ZgEcw1LzM3My",
    "button": {
        "type": "buy_now",
        "name": "Alpaca Socks",
        "description": "The ultimate in lightweight footwear",
        "id": "5d37a3b61914d6d0ad15b5135d80c19f"
    },
    "transaction": {
        "id": "514f18b7a5ea3d630a00000f",
        "hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
        "confirmations": 0
    }
}
}

I have tried using

$json = $_POST["order"]

to retrieve it but it doesn't work.

Aug 29, 2018 in Blockchain by digger
• 26,740 points
1,176 views

1 answer to this question.

0 votes

Try using

$get = file_get_contents("php://input");
answered Aug 29, 2018 by slayer
• 29,370 points
I faced the same problem. This fixed the isuue. Thanks!!

Related Questions In Blockchain

0 votes
1 answer

How to transact custom token instead of ethers using JSON rpc?

First create your custom token. Then develop ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 26,740 points
1,089 views
0 votes
1 answer

How to use Blockchain receive API without exchange rate?

Your code contains the amount in USD ...READ MORE

answered Aug 21, 2018 in Blockchain by Perry
• 17,100 points
911 views
0 votes
1 answer

How to parse Json data from remote server?

Yes, you can do it use the ...READ MORE

answered Aug 17, 2018 in Blockchain by digger
• 26,740 points
972 views
0 votes
1 answer

How to make a class that fits Blockchain.info Json?

Hey, I found a simple solution for ...READ MORE

answered Sep 18, 2018 in Blockchain by digger
• 26,740 points
1,590 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,295 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
924 views
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
2,383 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

How to receive JSON object via POST method?

You need to decode it with json_decode() like this $json ...READ MORE

answered Aug 28, 2018 in Blockchain by slayer
• 29,370 points
891 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP