Microservice to accept bitcoin payments
Charge: When a user request to make a payment a "Charge" is created, for this a bitcoin Address is created and monitored, charges are temporal and should only live for X ammount of minutes.
Store Address (SA): One address that its owned by the store
BPA Comissions Address (BPACA): One address owned by the BPA system
- Registered User enters Store.com
- User resquest to make a payment
- Store request a new "Charge" to the Bitcoin Payments API and asociates the Address with the user
- User makes the payment to the wallet
- The BPA waits for x confirmations then transfer 2% of original ammount + transfer free to BPACA and transfer the remaining ammount to SA
- Store calls the BPA for information about this address and receives that a new payment was done for X bitcoins
- Store creates a virtual credit for the user
When the Charge time expires the address is sent to an "expired" storage, along with its public and private keys, this address will stop being monitored and never be used again.
Request
curl -X POST https://bpa.io/api/v1/charge
Response
{
"address": "12AaMuRnzw6vW6s2KPRAGeX53meTf8JbZS",
"expires": "2019-10-11T02:34:27.769Z"
}
Request
curl https://bpa.io/api/v1/charge/12AaMuRnzw6vW6s2KPRAGeX53meTf8JbZS
Response
{
"address": "12AaMuRnzw6vW6s2KPRAGeX53meTf8JbZS",
"expires": "2019-10-11T02:34:27.769Z",
"payment_status": "completed",
"original_ammount": 0.3,
"final_ammount:": 0.2892636
}
Payment statuses:
new: Charge has been created
pending: A transaction has been received and waiting for confirmation or payment has been sent to SA address and waiting for confirmations.
completed: Payment has been sent to Store Address and has X confirmations
https://github.com/OpenBazaar/spvwallet
https://commerce.coinbase.com/docs/