简体   繁体   English

区块链支付API,如何处理回调

[英]Blockchain payment API, how to handle the callback

I am trying to understand the Blockchain.info Payment API . 我正在尝试了解Blockchain.info付款API I am a very beginner to PHP. 我是PHP的初学者。

I want to know how to handle the callback. 我想知道如何处理回调。

The Documentation tells me to provide a $callback_url: "The callback URL to be notified when a payment is received." 该文档告诉我提供一个$ callback_url:“在收到付款时将通知的回调URL。”

But i just do not understand how this callback_url have to look like. 但是我只是不明白这个callback_url的样子。 And what should the PHP code behind it do, to actually receive the information about the incoming payment. 以及背后的PHP代码应该做什么,才能实际接收有关收款的信息。

My guess so far: 到目前为止,我的猜测是:

Blockchain.info checks the generated address for incoming payments. Blockchain.info检查生成的地址以获取收款。 As soon as a new payment appears, the callback_url is notified. 一旦出现新的付款,就会通知callback_url。 That means that a "GET" Request is forwarded to the URL? 那意味着“ GET”请求被转发到URL? Now if i want to handle that data, i have to set up a database. 现在,如果我想处理这些数据,就必须建立一个数据库。 The data (like confirmations, Payment ammount, and so on) will then be written right into my database? 数据(例如确认,付款金额等)将直接写到我的数据库中吗? All i have to do then, is to check my database for a new entry? 然后,我要做的就是检查数据库中是否有新条目?

Please correct me and help me to understand how to handle this callback. 请更正我,并帮助我了解如何处理此回调。 Thank You 谢谢

It can be any http:// or https:// link that accepts get requests. 它可以是任何接受get请求的http://或https://链接。 So just create a callback.php file, and set the callback url to something like http://domain.com/callback.php and accept and validate all of the params sent. 因此,只需创建一个callback.php文件,并将回调URL设置为http://domain.com/callback.php之类,然后接受并验证发送的所有参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM