我必须通过 dotnet c# 中的订阅 id 检查特定订阅是否已退款 我正在使用 stripe SDK(.dll) 文件。
有人可以帮帮我吗
用于创建我正在使用的订阅
var service = new SubscriptionService();
您需要使用其 ID 检索订阅详细信息。然后,检查与订阅相关的最新发票,看看是否已退款。
var service = new SubscriptionService();
var subscription = service.Get("your_subscription_id");
if (subscription != null)
{
var invoiceService = new InvoiceService();
var latestInvoice = invoiceService.Get(subscription.LatestInvoiceId);
if (latestInvoice != null)
{
if (latestInvoice.AmountPaid < 0)
{
Console.WriteLine("Subscription has been refunded.");
}
else
{
Console.WriteLine("Subscription has not been refunded.");
}
}
else
{
Console.WriteLine("Latest invoice not found.");
}
}
else
{
Console.WriteLine("Subscription not found.");
}