closeStream

Closes an active stream

Important:

Closing the stream will cancel all pending transfers, sometimes even if the amount of pending lamports is greater than the threshold. If you want to stop the stream but still want to recover any pending lamports in cases where the amount of pending lamports is greater than the threshold, please use the pauseStream method instead.

There is no way to immediately recover pending lamports if the pending amount is less than the threshold. Instead, you can optionally retrieve the pending lamports using the getStreamDetails method and send them using one of the SOL Pay transaction methods (you may not always want to retrieve the pending lamports if the fee is too large compared to the pending amount).

The close stream method awaits for any pending transactions related to the current stream (refills or transfers) to complete to ensure that the state of the stream is finalized.

(async() => {
    let closed = await SOLPay.closeStream("..."); // true
})();

Parameters:

  • stream: string - the stream to close

Returns:

boolean (true) - the confirmation for closing a stream

Throws:

  • SOL Pay SDK Fatal Error: Invalid stream ${stream}. - an invalid stream was used

Last updated