Denota SDK
Search
⌃K

Direct Pay

The Direct Pay module enables sending payments without escrow. When a payment is sent, or an invoice is paid, funds are immediately available to the recipient without any holding period.

Usage

import Denota from '@denota-labs/denota-sdk';
async function createNota() {
const { txHash, notaId } = await Denota.write({
amount: 1,
currency: "DAI",
metadata: { type: "raw", notes: "Example invoice" },
module: {
moduleName: "direct",
type: "invoice",
creditor: "0x...",
debitor: "0x...",
},
});
}
createNota();
In the above code, we pass in the module object, which contains the details of the nota. We also pass in the amount and currency parameters, which represent the amount and the currency in which the nota is written.
The properties of the DirectPayData module object are as follows:
  • moduleName: Set to "direct" for the Direct Pay module.
  • type: Set to "invoice" for creating an invoice or "payment" for sending a payment.
  • creditor: The Ethereum address of the creditor or the recipient of the payment.
  • debitor: The Ethereum address of the debitor or the payer of the payment.
  • notes (optional): Any additional notes or comments regarding the payment or invoice.
  • file (optional): A File object containing any relevant documentation, like a statement of work, contract, or invoice.
  • ipfsHash (optional): The IPFS hash of any additional documentation, like a statement of work or contract, that has been uploaded to IPFS.
  • imageHash (optional): The IPFS hash of an image representing the payment or invoice, which can be used for display purposes.
  • dueDate (optional): A string representing the due date of the payment or invoice, formatted as "YYYY-MM-DD".