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
}
Filtering Payments
When listing payment you can also filter and page the list results, by:
Type and timestamp
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),
details: None,
})
.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
}
Bitcoin address
Rust
let address = "<Bitcoin address>".to_string();
let payments = sdk
.list_payments(&ListPaymentsRequest {
filters: None,
from_timestamp: None,
to_timestamp: None,
offset: None,
limit: None,
details: Some(ListPaymentDetails::Bitcoin {
address,
}),
})
.await?;
Swift
let address = "<Bitcoin address>"
let payments = try? sdk.listPayments(
req: ListPaymentsRequest(
details: ListPaymentDetails.bitcoin(address: address)
))
Kotlin
try {
val address = "<Bitcoin address>"
val payments = sdk.listPayments(
ListPaymentsRequest(
details = ListPaymentDetails.Bitcoin(address)
))
} catch (e: Exception) {
// handle error
}
React Native
try {
const payments = await listPayments({
details: {
type: ListPaymentDetailsVariant.BITCOIN,
address: '<Bitcoin address>'
}
})
} catch (err) {
console.error(err)
}
Dart
String address = "<Bitcoin address>";
ListPaymentsRequest req = ListPaymentsRequest(
details: ListPaymentDetails_Bitcoin(address: address),
);
List<Payment> paymentsList = await breezSDKLiquid.instance!.listPayments(req: req);
Python
address = "<Bitcoin address>"
req = ListPaymentsRequest(
details = ListPaymentDetails.BITCOIN(address))
sdk.list_payments(req)
Go
address := "<Bitcoin address>"
var details breez_sdk_liquid.ListPaymentDetails = breez_sdk_liquid.ListPaymentDetailsBitcoin{
Address: address,
}
listPaymentsRequest := breez_sdk_liquid.ListPaymentsRequest{
Details: &details,
}
if payments, err := sdk.ListPayments(listPaymentsRequest); err == nil {
log.Printf("%#v", payments)
}
C#
try
{
var address = "<Bitcoin address>";
var payments = sdk.ListPayments(
new ListPaymentsRequest(
details: new ListPaymentDetails.Bitcoin(address)
));
}
catch (Exception)
{
// Handle error
}
Liquid destination
Rust
let destination = "<Liquid BIP21 or address>".to_string();
let payments = sdk
.list_payments(&ListPaymentsRequest {
filters: None,
from_timestamp: None,
to_timestamp: None,
offset: None,
limit: None,
details: Some(ListPaymentDetails::Liquid {
destination,
}),
})
.await?;
Ok(payments)
}
Swift
let destination = "<Liquid BIP21 or address>"
let payments = try? sdk.listPayments(
req: ListPaymentsRequest(
details: ListPaymentDetails.liquid(destination: destination)
))
Kotlin
try {
val destination = "<Liquid BIP21 or address>"
val payments = sdk.listPayments(
ListPaymentsRequest(
details = ListPaymentDetails.Liquid(destination)
))
} catch (e: Exception) {
// handle error
}
React Native
try {
const payments = await listPayments({
details: {
type: ListPaymentDetailsVariant.LIQUID,
destination: '<Liquid BIP21 or address>'
}
})
} catch (err) {
console.error(err)
}
Dart
String destination = "<Liquid BIP21 or address>";
ListPaymentsRequest req = ListPaymentsRequest(
details: ListPaymentDetails_Liquid(destination: destination),
);
List<Payment> paymentsList = await breezSDKLiquid.instance!.listPayments(req: req);
Python
destination = "<Liquid BIP21 or address>"
req = ListPaymentsRequest(
details = ListPaymentDetails.LIQUID(destination))
sdk.list_payments(req)
Go
destination := "<Liquid BIP21 or address>"
var details breez_sdk_liquid.ListPaymentDetails = breez_sdk_liquid.ListPaymentDetailsLiquid{
Destination: destination,
}
listPaymentsRequest := breez_sdk_liquid.ListPaymentsRequest{
Details: &details,
}
if payments, err := sdk.ListPayments(listPaymentsRequest); err == nil {
log.Printf("%#v", payments)
}
C#
try
{
var destination = "<Liquid BIP21 or address>";
var payments = sdk.ListPayments(
new ListPaymentsRequest(
details: new ListPaymentDetails.Liquid(destination)
));
}
catch (Exception)
{
// Handle error
}
Get Payment
You can also retrieve a single Lightning payment using the invoice payment hash.
Rust
let payment_hash = "<payment hash>".to_string();
let payment = sdk.get_payment(&GetPaymentRequest::Lightning {
payment_hash
}).await?;
Swift
let paymentHash = "<payment hash>"
let payment = try? sdk.getPayment(
req: GetPaymentRequest.lightning(paymentHash: paymentHash)
)
Kotlin
try {
val paymentHash = "<payment hash>";
val payment = sdk.getPayment(GetPaymentRequest.Lightning(paymentHash))
} catch (e: Exception) {
// handle error
}
React Native
const paymentHash = '<payment hash>'
const payment = await getPayment({
type: GetPaymentRequestVariant.LIGHTNING,
paymentHash
})
Dart
String paymentHash = "<payment hash>";
GetPaymentRequest req = GetPaymentRequest.lightning(paymentHash: paymentHash);
Payment? payment = await breezSDKLiquid.instance!.getPayment(req: req);
Python
payment_hash = "<payment hash>"
sdk.get_payment(GetPaymentRequest.LIGHTNING(payment_hash))
Go
paymentHash := "<payment hash>"
req := breez_sdk_liquid.GetPaymentRequestLightning{
PaymentHash: paymentHash,
}
if payment, err := sdk.GetPayment(req); err == nil {
log.Printf("%#v", payment)
}
C#
try
{
var paymentHash = "<payment hash>";
var payment = sdk.GetPayment(
new GetPaymentRequest.Lightning(paymentHash)
);
}
catch (Exception)
{
// Handle error
}