贝宝分期付款的定期付款

Dav*_*d P 5 .net c# vb.net paypal

我想在我的.NET网站上发起一次捐赠活动,要求人们同意向我的组织捐赠200美元。由于有些人可能没有所有的预付款,所以我想让他们选择现在捐赠50美元或更多,然后将剩余部分摊派到1-3个额外的月度付款之间。

我是否需要针对每种可能的情况设置定期付款按钮,然后使用一些脚本来确定应将用户定向到哪个PayPal表单按钮?还是有一种更灵活的方法?

VDW*_*WWD 6

我认为您必须创建一个结算计划。以下摘录来自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")
                }
            }
        }
    }
};
Run Code Online (Sandbox Code Playgroud)