2

I'm creating a WordPress plugin for bitcoin donations. I want it to behave similar to the checkout process for many bitcoin shopping carts, where the QR code is displayed then once the user scans and sends bitcoin to the address, it swaps out with a "thank you" message.

I was thinking of using messages attached to the donation, or a specific amount for each donation, but it's getting complicated. How can I have a single receiving address for each donation, yet have the system know when the user Joe has donated vs when Bob donated, so they both get thank you message at the appropriate time.

Is this possible, or do I need to generate a middleman address for every transaction, and just check the balance on that one?

I only want to go this route so I'm not responsible for a screw up if someone donates, the site glitches, and the private key to the middleman address is lost before the funds can be forwarded on to the final receiving address.

1

1 Answer 1

1

Yes you can.

  1. If you're using a third party service to store your coins, they usually allow you to add a callback address when generating a new address, where they trigger a POST request to your server with a JSON object containing transaction details. Here are some examples:

    1. Coinbase's API: https://developers.coinbase.com/api#callbacks
    2. Blockchain.info's API: https://blockchain.info/api/api_receive
  2. If you're rolling your own addresses, you can use some block explorers to notify you of new transactions to existing addresses. One I know of is Chain.com's notification system. I haven't used this, but Chain is quite a developer friendly service.

Personally, I've only used Coinbase's API, and It worked quite well for me. I trust Coinbase to take care of my coins better than myself, but if you're more paranoid and better at security than I am, use Chain.

IMHO I don't recommend Blockchain.info for anything. Their service really isn't that polished from all I've seen, and I just get a bad vibe from them. Coinbase has very nice support and a developer community where you can talk about all the problems you face.

1
  • Full Disclosure: I'm BlockCypher's Developer Advocate, and therefore quite biased. That said, just wanted to point to two additional APIs we provide that might be useful for this case: Payment Forwarding (dev.blockcypher.com/#payment-forwarding) allows you to generate a new address and automatically forward along to a predetermined final address, while our WebHooks (dev.blockcypher.com/#events-and-hooks) are reliable and defiintely can be filtered to only show new transactions to a new address. Jul 20, 2015 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.