I got the following error "The type initializer for 'PayPal.Api.PayPalResource' threw an exception" when I initialized the plan object Plan plan = new Plan(); Got the same error if i use following sample code var shippingChargeModel = new ChargeModel() { type = "SHIPPING", amount = GetCurrency("9.99") }; return new Plan { name = "T-Shirt of the Month Club Plan", description = "Monthly plan for getting the t-shirt of the month.", 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("1"), return_url = returnUrl, cancel_url = cancelUrl, 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 $9.99 for the first // month. After that, the standard plan will take over for the // remaining 11 months of the year. new PaymentDefinition() { name = "Trial Plan", type = "TRIAL", frequency = "MONTH", frequency_interval = "1", amount = GetCurrency("9.99"), cycles = "1", charge_models = new List<ChargeModel> { new ChargeModel() { type = "TAX", amount = GetCurrency("1.65") }, shippingChargeModel } }, // Define the standard payment plan. It will represent a monthly // plan for $19.99 USD that charges once month for 11 months. new PaymentDefinition { name = "Standard Plan", type = "REGULAR", frequency = "MONTH", frequency_interval = "1", amount = GetCurrency("19.99"), // > NOTE: For `IFNINITE` type plans, `cycles` should be 0 for a `REGULAR` `PaymentDefinition` object. cycles = "11", charge_models = new List<ChargeModel> { new ChargeModel { type = "TAX", amount = GetCurrency("2.47") }, shippingChargeModel } } } };
... View more