Order Callback hook URL

Hi,

I am using the Payment Widget. In the blockonomicsPaymentCallback, the transaction Id is available in the function arguments, however, in the Order Callback Hook the txid is no longer available. I can see in the Callback logs that the txid is passed by this api:

https://www.blockonomics.co/api/merchant_callback

I’m wondering if the Order Callback hook does not really pass the txid? or if that’s not the case, can you maybe point me in the right direction?

By the way, I am still on the testing part of this integration and no real payment has been done yet.

Thanks

Hi @cge when you provide the order callback hook, Blockonomics server will send callback and it will have txid in the response.
Please checkout our API doc Blockchain API | Bitcoin API - Blockonomics and here’s a tutorial on our dev library - Introduction to Payment Button API – Dev Library
Let me know if you need detailed explanation. Thanks!

Hi @dankit,

Thanks for your reply.

Apparently when I tested it locally, there is no txid sent by the blockonomics. Here’s a sample log:

[Jun 08,2023 16:24:49]
https://d07d-20-43-178-141.ngrok-free.app/umbraco/api/Blockonomics/OrderCallback?key=076B89167BA24FDCADC71137271747716890CC0C4D414CE99028B943B946EC91&addr=bc1qwkq37hwtsvsqkty250gqygjqnphznufjjt8fuq&status=1&uuid=d91e1e3215a045219519 200

[Jun 08,2023 16:35:03]
https://d07d-20-43-178-141.ngrok-free.app/umbraco/api/Blockonomics/OrderCallback?key=076B89167BA24FDCADC71137271747716890CC0C4D414CE99028B943B946EC91&addr=bc1qwkq37hwtsvsqkty250gqygjqnphznufjjt8fuq&status=2&uuid=d91e1e3215a045219519 200

I’ve also went through the API docs and read there that it should have the txid sent to my callback.

Thanks

@cge txid is not sent in order hook callback. You should call GET /api/merchant_order/<uuid> endpoint to get the txid and other customer data .
For detail you can also refer to Introduction to Payment Button API – Dev Library

Hi @cge
​The Order Hook will only contain the Bitcoin payment status and the order UUID

Example callback from server
<OrderHook_URL>?status=2&uuid=2b0c7e2cd523458098b2

To get the values of the custom fields, you can call the order API point. Here are some examples which include your use case Introduction to Payment Button API – Dev Library see Order Hook URL Endpoint Logic

Here is an example request
https://www.blockonomics.co/api/merchant_order/23ba2ce9c9114d91b755

Here is the response for above, note that it includes txid

{
    "status": 2,
    "emailid": "asdfg@gmail.com",
    "code": "Product#1",
    "satoshi": 37304,
    "uuid": "23ba2ce9c9114d91b755",
    "currency": "USD",
    "timestamp": 1685526128,
    "value": 10.0,
    "name": "article buying",
    "xpub": "zpub6qpUSqYMmAqPJk8uTC1qTmRr4i1wVsQnFDWNfkhKrGd63YuevKYnnJxiKA1o9ZAKpUQ1AR71ubtvEZpXgjuReq8tztTw97LyHf2YKKw17eH",
    "address": "bc1qzcldc4jq8evswu9dpzhvk57xed4vuqge37tt2w",
    "paid_satoshi": 100000,
    "txid": "WarningThisIsAGeneratedTestPaymentAndNotARealBitcoinTransaction",
    "data": {
        "emailid": "yellow@gmail.com",
        "color": "grey",
        "name": "yellow fellow",
        "size": "XXXL"
    },
    "description": "Sample buy"
}

Please let me know if you have any questions, thanks!

Hi @dankit,

Sorry for the late reply. Thank you for your answer. This helps alot.

One more question, what are the chances that a transaction fails? Based on the status that is passed onto the callback it does not have a failed status.

Again, thank you for your help.

Hi @cge Please note that a callback succeeds when the server returns 200 HTTP status. Callback are retried 7 times with an exponential backoff of 4 seconds" So failing callbacks are retried up to 7 times.

As for the actual succeeding callbacks, one callback is sent for status 0, one for status 1 and one for status 2 and this is the intended behaviour. You will need to catch the status of the callback and have the code act accordingly. It is strongly suggested to accept payments only after status 2 has arrived. Here is our API documentation regarding same - Blockchain API | Bitcoin API - Blockonomics