gpt4 book ai didi

c# - PayPal 定期捐款分期付款

转载 作者:太空狗 更新时间:2023-10-29 23:04:55 26 4
gpt4 key购买 nike

我想在我的 .NET 网站上发起一项捐赠事件,请人们同意向我的组织捐赠 200.00 美元。由于有些人可能没有预付所有的钱,我想让他们选择现在捐赠 50 美元或更多,然后将剩余的部分分摊到 1-3 个月的额外付款中。

我是否需要为每个可能的场景设置循环支付按钮,然后使用一些脚本来确定我应该将用户引导至哪个 PayPal 表单按钮?还是有更灵活的方法来做到这一点?

最佳答案

我认为您必须创建一个计费计划。以下片段来自 PayPal SDK .我根据您的需要对其进行了一些修改,但您仍然需要对其进行自定义。

var plan = new Plan
{
name = "Donation Split Payment",
description = "Monthly plan for the less fortunate.",
type = "fixed",
// Define the merchant preferences.
// More Information: https://developer.paypal.com/webapps/developer/docs/api/#merchantpreferences-object
merchant_preferences = new MerchantPreferences()
{
setup_fee = GetCurrency("0"),
return_url = httpContext.Request.Url.ToString(),
cancel_url = httpContext.Request.Url.ToString() + "?cancel",
auto_bill_amount = "YES",
initial_fail_amount_action = "CONTINUE",
max_fail_attempts = "0"
},
payment_definitions = new List<PaymentDefinition>
{
// Define a trial plan that will only charge $50 for the first
// month. After that, the standard plan will take over for the
// remaining 4 months.
new PaymentDefinition()
{
name = "First Payment",
type = "REGULAR",
frequency = "MONTH",
frequency_interval = "1",
amount = GetCurrency("50.00"),
cycles = "1",
charge_models = new List<ChargeModel>
{
new ChargeModel()
{
type = "TAX",
amount = GetCurrency("9.99")
}
}
},
// Define the standard payment plan. It will represent a monthly
// plan for $50 USD that charges once month for 3 months.
new PaymentDefinition
{
name = "Other payment",
type = "REGULAR",
frequency = "MONTH",
frequency_interval = "1",
amount = GetCurrency("50.00"),
// > NOTE: For `IFNINITE` type plans, `cycles` should be 0 for a `REGULAR` `PaymentDefinition` object.
cycles = "3",
charge_models = new List<ChargeModel>
{
new ChargeModel
{
type = "TAX",
amount = GetCurrency("9.99")
}
}
}
}
};

关于c# - PayPal 定期捐款分期付款,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57731023/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com