Skip to content

Payment Confirmation Notifications #1

@stevenzeiler

Description

@stevenzeiler

Clients shall subscribe to new payment confirmation notifications over websockets and receive the payment confirmation information in real time.

To achieve this, expose an invoice subscription object, which is an event emitter wrapping the events for a specific invoice.

Clients may subscribe to an invoice's events by providing its uid.

Here is a proposed interface

import { subscribe } from 'anypay'

const invoice = await subscribe({ uid: '71d3debf-b828-424c-b7b2-1299107b776' })

invoice.on("payment.unconfirmed", payment => { console.log("payment received but not confirmed"})

invoice.on("payment.confirmed", payment => { console.log("payment received the required number of confirmations") })

Often you will want to know when new blocks are added on top of the original block that included your transaction. For instance one exchange process may require 3 confirmations while another requires 100 confirmations, and another just 1. It all depends on the risk level associated with the payment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions