Bill Management

The billManager provides methods to create and manage both one-time and recurring bills.

Fetching Bills

Fetch Single Bill

const bill = await client.billManager.fetchBill(billId, {
	includeBalance: true, // Include current balance
	includeRecords: true, // Include payment records
});

Fetch Multiple Bills

const bills = await client.billManager.fetchBills([billId1, billId2], {
	includeBalance: true,
	includeRecords: true,
});

Creating Bills

Create One-time Bill

const { resp, billObjChange } = await client.billManager.createBill(
	coinType, // e.g., "0x2::sui::SUI"
	amount, // Amount in smallest unit
	payers, // Array of nominated payer addresses (optional)
	billManager, // Address that can manage the bill
	description, // Bill description
	{
		type: 'regular', // One-time bill
	},
);

Create Recurring Bill

Managing Bills

Pay Bill

Cancel Bill

Reject Bill

Claim Payment

Claim Back Payment

Bill Objects

Bills returned by the SDK include:

Status Values

  • 0: INPROGRESS - Bill is active and accepting payments

  • 1: PAID - Bill has received full payment (one-time bills only)

  • 2: COMPLETED - Bill has been claimed (one-time bills only)

  • 3: CANCELED - Bill has been canceled

  • 4: REJECTED - Bill has been rejected

Error Handling

Handle specific bill management errors:

Common Use Cases

  1. Create and Track Bill:

  1. Pay and Claim Bill:

Last updated