Fiber LogoFiber Docs
RPC API Reference

Module `Invoice`

Invoice management RPC methods

Module Invoice

RPC module for invoice management.

Method new_invoice

Generates a new invoice.

Params

  • amount - u128, The amount of the invoice.
  • description - Option<String>, The description of the invoice.
  • currency - Currency, The currency of the invoice.
  • payment_preimage - Option<[Hash256](#type-hash256)>, The preimage to settle an incoming TLC payable to this invoice. If preimage is set, hash must be absent. If both preimage and hash are absent, a random preimage is generated.
  • payment_hash - Option<[Hash256](#type-hash256)>, The hash of the preimage. If hash is set, preimage must be absent. This condition indicates a 'hold invoice' for which the tlc must be accepted and held until the preimage becomes known.
  • expiry - Option<u64>, The expiry time of the invoice, in seconds.
  • fallback_address - Option<String>, The fallback address of the invoice.
  • final_expiry_delta - Option<u64>, The final HTLC timeout of the invoice, in milliseconds. Minimal value is 16 hours, and maximal value is 14 days.
  • udt_type_script - Option<Script>, The UDT type script of the invoice.
  • hash_algorithm - Option<[HashAlgorithm](#type-hashalgorithm)>, The hash algorithm of the invoice.
  • allow_mpp - Option<bool>, Whether allow payment to use MPP
  • allow_trampoline_routing - Option<bool>, Whether allow payment to use trampoline routing

Returns

  • invoice_address - String, The encoded invoice address.
  • invoice - CkbInvoice, The invoice.

Method parse_invoice

Parses a encoded invoice.

Params

  • invoice - String, The encoded invoice address.

Returns


Method get_invoice

Retrieves an invoice.

Params

  • payment_hash - Hash256, The payment hash of the invoice.

Returns

  • invoice_address - String, The encoded invoice address.
  • invoice - CkbInvoice, The invoice.
  • status - CkbInvoiceStatus, The invoice status

Method cancel_invoice

Cancels an invoice, only when invoice is in status Open can be canceled.

Params

  • payment_hash - Hash256, The payment hash of the invoice.

Returns

  • invoice_address - String, The encoded invoice address.
  • invoice - CkbInvoice, The invoice.
  • status - CkbInvoiceStatus, The invoice status

Method settle_invoice

Settles an invoice by saving the preimage to this invoice.

Params

  • payment_hash - Hash256, The payment hash of the invoice.
  • payment_preimage - Hash256, The payment preimage of the invoice.

Returns

  • None

Fiber AI Assistant

Ask me anything

I can answer questions about Fiber Network using our documentation.

AI answers are based on Fiber documentation