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?
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")
}
}
}
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With