blockchain api payment module

0 votes

We have a website with some digital goods. A user to buy from there is required to buy some credit, with BTC. After he buys the credit, the script has to load his account with the amount of currency (USD) he purchased with BTC.

So here we have the HTML form:

<form name="bitcoin" method="post" action="btc.php"> <strong><font color="grey">$</font></strong> <input name="member" value="<?php echo $_SESSION['gdusername'];?>" type="hidden"> <input name="amount" size="10" value="" type="text"> <input name="btnPMPay" id="btnPMPay" value="Add Balance" type="submit"> </form>

My problem is that this PHP script doesn't do the following.

  1. Do not interrogate the blockchain to see if the transfer was made although there are 0 confirmations when the user hits the confirm button.

  2. Do not UPDATE into the database of the credit purchased by the customer after he hits the confirm button.

  3. Even though I entered a value higher that 5$ he still keep telling me that the minimum payment value is 5$.

Can anyone help me with this?

Apr 7, 2022 in Blockchain by Rahul
• 9,670 points
600 views

1 answer to this question.

0 votes

No curly braces after your if statement. I assume your script keeps dying at this point and tells you "Minimum payment $5"?

if (!isset($_SESSION['USD_amount']) || $_SESSION['USD_amount'] < 5) die("Minimum payment 5$");

Also, your GUID on the blockchain is sensitive info, you shouldn't post that. It could lead to someone trying to take your funds through the recover wallet features.

Not sure how much traffic you get but your blockchain.info wallet will max out after 1,000 addresses.

answered Apr 11, 2022 by Soham
• 9,700 points

Related Questions In Blockchain

0 votes
1 answer

Send Payment error in Blockchain API

The following code should help: $address = null; try ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
1,545 views
+1 vote
1 answer

Transaction using Blockchain wallet APi

Each transaction requires a fee to be ...READ MORE

answered Jun 19, 2018 in Blockchain by Perry
• 17,100 points
460 views
+1 vote
1 answer

Unable to send payment using API. Please help.

Firstly, check your passwords, your API code and your wallet ...READ MORE

answered Apr 3, 2018 in Blockchain by Christine
• 15,790 points
853 views
+2 votes
1 answer

Blockchain declining my API key and I cannot understand why.

It's quite easy. Request the API key using ...READ MORE

answered Apr 3, 2018 in Blockchain by Christine
• 15,790 points
1,788 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
9,438 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,240 points
895 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,655 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,211 views
0 votes
1 answer

How To Get BTC Price on Binance from Binance API

In the Script environment for Apps, the ...READ MORE

answered Feb 28, 2022 in Blockchain by Soham
• 9,700 points
1,985 views
0 votes
1 answer

How can merkle trees help validate the content of a block in a blockchain

As long as they are centralized entities ...READ MORE

answered Feb 28, 2022 in Blockchain by Soham
• 9,700 points
491 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