Listing Payments

To view your payment history you can list all the sent and received payments made.

Rust
let payments = sdk.list_payments(&ListPaymentsRequest::default()).await?;
Swift
let payments = try? sdk.listPayments(req: ListPaymentsRequest())
Kotlin
try {
    val payments = sdk.listPayments(ListPaymentsRequest())
} catch (e: Exception) {
    // handle error
}
React Native
const payments = await listPayments({})
Dart
ListPaymentsRequest req = ListPaymentsRequest();
List<Payment> paymentsList = await breezSDKLiquid.instance!.listPayments(req: req);
Python
sdk.list_payments(ListPaymentsRequest())
Go
if payments, err := sdk.ListPayments(breez_sdk_liquid.ListPaymentsRequest{}); err == nil {
    log.Printf("%#v", payments)
}
C#
try
{
    var payments = sdk.ListPayments(new ListPaymentsRequest());
}
catch (Exception)
{
    // Handle error
}

You can optionally filter payments by timestamp and type.

Rust
let payments = sdk
    .list_payments(&ListPaymentsRequest {
        filters: Some(vec![PaymentType::Send]),
        from_timestamp: Some(1696880000),
        to_timestamp: Some(1696959200),
        offset: Some(0),
        limit: Some(50),
    })
    .await?;
Swift
let payments = try? sdk.listPayments(
    req: ListPaymentsRequest(
        filters: [.send],
        fromTimestamp: 1696880000,
        toTimestamp: 1696959200,
        offset: 0,
        limit: 50
    ))
Kotlin
try {
    val payments = sdk.listPayments(
        ListPaymentsRequest(
            listOf(PaymentType.SEND),
            fromTimestamp = 1696880000,
            toTimestamp = 1696959200,
            offset = 0u,
            limit = 50u
        ))
} catch (e: Exception) {
    // handle error
}
React Native
try {
  const payments = await listPayments({
    filters: [PaymentType.SEND],
    fromTimestamp: 1696880000,
    toTimestamp: 1696959200,
    offset: 0,
    limit: 50
  })
} catch (err) {
  console.error(err)
}
Dart
ListPaymentsRequest req = ListPaymentsRequest(
  filters: [PaymentType.send],
  fromTimestamp: 1696880000,
  toTimestamp: 1696959200,
  offset: 0,
  limit: 50,
);
List<Payment> paymentsList = await breezSDKLiquid.instance!.listPayments(req: req);
Python
req = ListPaymentsRequest(
    [PaymentType.SEND], 
    from_timestamp = 1696880000, 
    to_timestamp = 1696959200, 
    offset = 0,
    limit = 50)
sdk.list_payments(req)
Go
filters := []breez_sdk_liquid.PaymentType{breez_sdk_liquid.PaymentTypeSend}
fromTimestamp := int64(1696880000)
toTimestamp := int64(1696959200)
limit := uint32(50)
offset := uint32(0)
listPaymentsRequest := breez_sdk_liquid.ListPaymentsRequest{
    Filters:       &filters,
    FromTimestamp: &fromTimestamp,
    ToTimestamp:   &toTimestamp,
    Offset:        &offset,
    Limit:         &limit,
}
if payments, err := sdk.ListPayments(listPaymentsRequest); err == nil {
    log.Printf("%#v", payments)
}
C#
try
{
    var payments = sdk.ListPayments(
        new ListPaymentsRequest(
            new() { PaymentType.Send },
            fromTimestamp: 1696880000,
            toTimestamp: 1696959200,
            offset: 0,
            limit: 50
        ));
}
catch (Exception)
{
    // Handle error
}