-
Notifications
You must be signed in to change notification settings - Fork 6
Sellers payment API. #13
Description
Motivation
Sellers should be able to process Gooddollar payments through our API.
For example:
A Seller like e-commerce for "brand" would like to be able to request payment from his customers at Gooddollar.
Details
Seller API
Create a typescript NPM module that works both on browser/node that implements the following methods
-
generatePaymentLink(PaymentDetails):string- Similar to (https://github.com/GoodDollar/GoodDAPP/blob/master/src/lib/share/index.js
generateCode + readCode) - Should include extra details from PaymentDetails
Example:
http://wallet.gooddollar.org:3000/? code=eyJtIjoiM2RQQjRxUjNBZUoyY0tzalJnYWp3dE1hUms3TjI0aFVMZzYiLCJhIjoiM...
the query param code is the base64 encrypted value returned from generateCodeThe generated code should return an object with the paymenDetails params and the ones that we already have
Example:
{ "m":"3dPB4qR3AeJ2cKsjRgajwtMaRk7N24hULg6", "a":"22200", "r":"afds", "cat":"Digital Services" } - Similar to (https://github.com/GoodDollar/GoodDAPP/blob/master/src/lib/share/index.js
-
generatePaymentQR(PaymentDetails):image- Same as above but create a QR containing the payment link from the
generatePaymentLinkmethod described above.
I suggest https://www.npmjs.com/package/qrcode for generating the image
- Same as above but create a QR containing the payment link from the
-
validateTx(TxData):boolean- Reads fuse blockchain for txhash and check it has a Transfer log with the
amount+sha3(invoiceid/data)paid torecipientin event log data
- Reads fuse blockchain for txhash and check it has a Transfer log with the
-
async onPayment(recipient,invoiceid):Promise- Listens to Transfer event with to=recipient and data=sha3(invoiceid/data)
- resolves promise once event detected
Types
PaymentDetails: {
recipient,
amount,
reason,
category,
invoiceId,
data?,
sellerName?,
sellerWebsite?,
callbackurl
}
TxData: {
txHash,
recipient,
amount
invoiceId,
data?
}
To get approved or help join:
https://t.me/gooddollarbounties