Skip to content

Sellers payment API. #13

@TomasGonzalez

Description

@TomasGonzalez

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

    Example:

    http://wallet.gooddollar.org:3000/? code=eyJtIjoiM2RQQjRxUjNBZUoyY0tzalJnYWp3dE1hUms3TjI0aFVMZzYiLCJhIjoiM...
    the query param code is the base64 encrypted value returned from generateCode

    The 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"
    }
      
    
  • generatePaymentQR(PaymentDetails):image

    • Same as above but create a QR containing the payment link from the generatePaymentLink method described above.
      I suggest https://www.npmjs.com/package/qrcode for generating the image
  • validateTx(TxData):boolean

    • Reads fuse blockchain for txhash and check it has a Transfer log with the amount + sha3(invoiceid/data) paid to recipient in event log data
  • 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

Also for any questions refer to:

@TomasGonzalez

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions