Merge pull request #108 from breez/webhooks

Webhooks documentation.
This commit is contained in:
Roei Erez
2023-12-17 14:42:44 +02:00
committed by GitHub
12 changed files with 394 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ mod send_payment;
mod send_spontaneous_payment;
mod service_status;
mod static_channel_backup;
mod webhook;
use anyhow::Result;
use breez_sdk_core::*;

View File

@@ -0,0 +1,19 @@
use std::sync::Arc;
use anyhow::Result;
use breez_sdk_core::*;
async fn webhook(sdk: Arc<BreezServices>) -> Result<()> {
// ANCHOR: register-webook
sdk.register_webhook("https://yourapplication.com".to_string()).await?;
// ANCHOR_END: register-webook
Ok(())
}
async fn payment_webhook(sdk: Arc<BreezServices>) -> Result<()> {
// ANCHOR: register-payment-webook
sdk.register_webhook("https://your-nds-service.com/notify?platform=ios&token=<PUSH_TOKEN>".to_string()).await?;
// ANCHOR_END: register-payment-webook
Ok(())
}