You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过C# Stripe API重新发送成功付款的收据邮件?

使用C# Stripe API重新发送付款收据的方法

可以的,Stripe API支持为已完成的付款重新发送收据,在C#中借助Stripe.NET库就能实现,分两种常见集成场景处理:

针对PaymentIntent(新版推荐方案)

如果你的系统使用Stripe新版的PaymentIntent流程,直接调用PaymentIntentService的SendReceiptAsync方法即可,还能指定新的收件邮箱:

using Stripe;

// 配置你的Stripe API密钥
StripeConfiguration.ApiKey = "sk_your_secret_key";

var paymentIntentService = new PaymentIntentService();
var sendOptions = new PaymentIntentSendReceiptOptions
{
    Email = "target@example.com" // 这里填写你要发送的指定邮箱
};

// 替换为实际的已完成付款的PaymentIntent ID
await paymentIntentService.SendReceiptAsync("pi_1234567890abcdef", sendOptions);

针对Charge(旧版集成场景)

若你的系统仍在使用旧版Charge对象,可通过ChargeService的对应方法实现:

using Stripe;

StripeConfiguration.ApiKey = "sk_your_secret_key";

var chargeService = new ChargeService();
var sendOptions = new ChargeSendReceiptOptions
{
    Email = "target@example.com"
};

// 替换为实际的已完成付款的Charge ID
await chargeService.SendReceiptAsync("ch_0987654321fedcba", sendOptions);

关键注意事项

  • 付款状态必须是succeeded(已完成)才能触发收据发送
  • 若不指定Email参数,Stripe会默认发送到付款时关联的原邮箱
  • 确保使用的API密钥拥有write权限,否则会触发权限错误

内容的提问来源于stack exchange,提问作者Cornel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 12:19:55