Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal Recurring Payments for Installment Donations

I would like to start a donation campaign on my .NET website, asking people to agree to donate $200.00 to my organization. Since some people might not have all the money up front, I want to give them the option of donating $50 or more now, and then spread out the remainder between 1-3 additional monthly payments.

Do I need to set up recurring payment buttons for every possible scenario, and then use some script to determine which PayPal form button I should direct the user to? Or is there a more flexible way of doing this?

like image 535
David P Avatar asked Aug 30 '19 17:08

David P


1 Answers

I think you have to create a Billing Plan. Below snippet is from the PayPal SDK. I modified it a little for your needs, but you still would need to customize it.

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")
                }
            }
        }
    }
};
like image 199
VDWWD Avatar answered Nov 10 '22 00:11

VDWWD