Bitcoin Forum

Other => Beginners & Help => Topic started by: TexasGreg on December 27, 2017, 03:02:28 PM



Title: Blockchain API Payment Processing
Post by: TexasGreg on December 27, 2017, 03:02:28 PM
This is my first post. I'm adding Bitcoin as a payment option to one of my websites and have some questions about functionality. Since the buyer controls how much they pay, how do you handle underpayments? Since the buyer has the payment address, how do you handle later payments since the buyer would likely only do this if the conversion rate is in his favor? I put a 5-minute timer on my payment page so I could make it where any payments after the 5 minutes would not result in shipment but that would create a headache. Will the API callback occur multiple times for multiple payments to the same address? I would check this out for myself if not for the current high transaction fees.

Thanks in advance.

Greg


Title: Re: Blockchain API Payment Processing
Post by: Bitfort on December 27, 2017, 05:27:24 PM
Hi and welcome.
I don't have much experience with blockchain API just wanted to let you know you can use some established payment processor like bipay or myceliumgear ... these should take care of similar issues.


BTW for testing purposes you can try using bitcoin testnet (these coins are very same to BTC but you can get them for free)


Title: Re: Blockchain API Payment Processing
Post by: NeuroticFish on December 27, 2017, 05:37:02 PM
This is my first post. I'm adding Bitcoin as a payment option to one of my websites and have some questions about functionality. Since the buyer controls how much they pay, how do you handle underpayments? Since the buyer has the payment address, how do you handle later payments since the buyer would likely only do this if the conversion rate is in his favor? I put a 5-minute timer on my payment page so I could make it where any payments after the 5 minutes would not result in shipment but that would create a headache. Will the API callback occur multiple times for multiple payments to the same address? I would check this out for myself if not for the current high transaction fees.

Thanks in advance.

Greg

One of the websites I am buying from has a payment processor that accepts Bitcoin.
In order to have the payment automatically processed, I have to make the transfer within 20 minutes and I think that it has to be one transfer with the correct (displayed) amount.
If the tx is relayed within the 20 minutes, "I am good" and when 1 or 3 confirmations passed the seller sends the "payment received" e-mail.

So the 1st check is (afaik) by time and amount and a second check is done to make sure the tx gets confirmed.


You can clearly state that if they send less than the required amount, that is considered a donation. Keep it simple.


Title: Re: Blockchain API Payment Processing
Post by: mocacinno on December 27, 2017, 05:39:15 PM
5 minutes is a really short time imho. People might need to move funds, sweep paper wallets, search the key for the old ledger HW.1 in order to sign a transaction.
Bitpay waits 15 minutes, i think that's reasonable...

As for you choice of using the blockchain api, i agree to one of the previous posters: why don't you use an established payment provider like bitpay or coinpayments? If you're set on doing things yourself (to have full controll, or because you don't like to pay a fee), i'd suggest running your own node and using json-rpc query's, or using an xpub from an offline electrum wallet to derive new payment addresses for each customer without exposing your private key or xprv on an online server...


Title: Re: Blockchain API Payment Processing
Post by: TexasGreg on December 27, 2017, 08:27:06 PM
Hi and welcome.
I don't have much experience with blockchain API just wanted to let you know you can use some established payment processor like bipay or myceliumgear ... these should take care of similar issues.


BTW for testing purposes you can try using bitcoin testnet (these coins are very same to BTC but you can get them for free)



I'm trying to avoid the up to 1% fee. I'll check out bitcoin testnet. Thanks


Title: Re: Blockchain API Payment Processing
Post by: TexasGreg on December 27, 2017, 08:43:43 PM
You can clearly state that if they send less than the required amount, that is considered a donation. Keep it simple.

It would be nice if I could get away with this.  ;D


Title: Re: Blockchain API Payment Processing
Post by: TexasGreg on December 27, 2017, 09:04:48 PM
5 minutes is a really short time imho. People might need to move funds, sweep paper wallets, search the key for the old ledger HW.1 in order to sign a transaction.
Bitpay waits 15 minutes, i think that's reasonable...

Ok I'll up the time limit. I was just thinking of the volatility.

As for you choice of using the blockchain api, i agree to one of the previous posters: why don't you use an established payment provider like bitpay or coinpayments? If you're set on doing things yourself (to have full controll, or because you don't like to pay a fee), i'd suggest running your own node and using json-rpc query's, or using an xpub from an offline electrum wallet to derive new payment addresses for each customer without exposing your private key or xprv on an online server...

I tried setting up my own node but go nowhere. I know some PHP and that's about it.


Title: Re: Blockchain API Payment Processing
Post by: mocacinno on December 28, 2017, 01:25:26 AM
5 minutes is a really short time imho. People might need to move funds, sweep paper wallets, search the key for the old ledger HW.1 in order to sign a transaction.
Bitpay waits 15 minutes, i think that's reasonable...

Ok I'll up the time limit. I was just thinking of the volatility.

As for you choice of using the blockchain api, i agree to one of the previous posters: why don't you use an established payment provider like bitpay or coinpayments? If you're set on doing things yourself (to have full controll, or because you don't like to pay a fee), i'd suggest running your own node and using json-rpc query's, or using an xpub from an offline electrum wallet to derive new payment addresses for each customer without exposing your private key or xprv on an online server...

I tried setting up my own node but go nowhere. I know some PHP and that's about it.

It's doable using php...
Just use easybitcoin:
https://github.com/aceat64/EasyBitcoin-PHP

then build a connection
Code:
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('[your rcp username here]','[your rcp password here]','[bitcoind\'s ip address here]','8332');

then you can just send requests
for example, to decode a raw transaction stored in the variable $raw
Code:
$decoded = decoderaw($raw, $bitcoin)


Title: Re: Blockchain API Payment Processing
Post by: TexasGreg on December 29, 2017, 01:52:17 PM
5 minutes is a really short time imho. People might need to move funds, sweep paper wallets, search the key for the old ledger HW.1 in order to sign a transaction.
Bitpay waits 15 minutes, i think that's reasonable...

Ok I'll up the time limit. I was just thinking of the volatility.

As for you choice of using the blockchain api, i agree to one of the previous posters: why don't you use an established payment provider like bitpay or coinpayments? If you're set on doing things yourself (to have full controll, or because you don't like to pay a fee), i'd suggest running your own node and using json-rpc query's, or using an xpub from an offline electrum wallet to derive new payment addresses for each customer without exposing your private key or xprv on an online server...

I tried setting up my own node but go nowhere. I know some PHP and that's about it.

It's doable using php...
Just use easybitcoin:
https://github.com/aceat64/EasyBitcoin-PHP

then build a connection
Code:
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('[your rcp username here]','[your rcp password here]','[bitcoind\'s ip address here]','8332');

then you can just send requests
for example, to decode a raw transaction stored in the variable $raw
Code:
$decoded = decoderaw($raw, $bitcoin)

Thanks but that's all still over my head. I'm just about finished integrating the Blockchain API. It's looking good thus far.