Plan
Plan: Create
- C#
var request = new PlanRequest {
Name = "the_name",
BillingFrequency = "the_billing_frequency",
CurrencyIsoCode = "the_currency_iso_code",
Price = "the_price"
};
Result<plan> result = gateway.Plan.Create(request);
Parameters
The collection of add-ons associated with a plan. Add-on details can only be managed within the Control Panel.
Add
arrayAmount
DecimalDescription
stringInheritedFromId
stringName
stringNumberOfBillingCycles
stringRemove
arrayUpdate
arrayAmount
DecimalDescription
stringExistingId
stringName
stringNumberOfBillingCycles
stringBillingDayOfMonth
integer or stringBillingFrequency
integer or stringCurrencyIsoCode
stringDescription
stringA collection of discounts associated with this plan. Discount details can only be managed within the Control Panel.
Add
arrayAmount
DecimalDescription
stringInheritedFromId
stringName
stringNumberOfBillingCycles
stringRemove
arrayUpdate
arrayAmount
DecimalDescription
stringExistingId
stringName
stringNumberOfBillingCycles
stringId
stringModificationTokens
stringName
stringNeverExpires
boolean or stringNumberOfBillingCycles
integer or stringPrice
decimal or stringThe trial timeframe specified in a plan. It is required if the trial period is set to true and must be 1-3 digits. If you specify a trial duration of 0, the gateway will start the subscription immediately and not consider it to include a trial period.
TrialDurationUnit
stringday
or month
.TrialPeriod
boolA value indicating whether a subscription should begin with a trial period. If not specified on creation, the gateway will generate false by default. It cannot have both a specified billing date and a trial period.
Add add_ons/discounts when creating a plan
There are two ways to add add_ons/discounts when creating a plan. First, modification tokens can be
passed along when creating a plan. A modification is either an add_on or a discount.
- C#
String[] modification_tokens = {"modification1_token", "modification2_token"};
var request = new PlanRequest {
name = "the_name",
billingFrequency = "the_billing_frequency",
currencyIsoCode = "the_currency_iso_code",
price = "the_price",
modification_tokens = modification_tokens
};
Result<plan> result = gateway.plan.Create(request);
- Add-ons/discounts that would be inherited from the plan can be updated on the plan.
- Add-ons/discounts that would be inherited from the plan can be removed from the plan.
- C#
var request = new PlanRequest {
Name = "theName",
BillingFrequency = "theBillingFrequency",
CurrencyIsoCode = "theCurrencyIsoCode",
Price = "the_price",
AddOns = new AddOnsRequest {
Add = new AddAddOnRequest[] {
new AddAddOnRequest {
InheritedFromId = "add_on_id_1",
Amount = 20.00M
},
new AddAddOnRequest {
InheritedFromId = "add_on_id_2",
Amount = 30.00M
}
},
Update = new UpdateAddOnRequest[] {
new UpdateAddOnRequest {
ExistingId = "add_on_id_3",
Description = "Updated description"
},
new UpdateAddOnRequest {
ExistingId = "add_on_id_4",
Description = "Updated description"
}
},
Remove = new String[] {
"add_on_id_5",
"add_on_id_6"
}
},
Discounts = new DiscountsRequest {
Add = new AddDiscountRequest[] {
new AddDiscountRequest {
InheritedFromId = "discount_id_1",
Amount = 7.00M
}
},
Update = new UpdateDiscountRequest[] {
new UpdateDiscountRequest {
ExistingId = "discount_id_2",
Amount = 15.00M
}
},
Remove = new String[] {
"discount_id_3"
}
}
};
Result<plan> result = gateway.Plan.Create(request);
- Amount
- NumberOfBillingCycles
- Name
- Description
- C#
var request = new PlanRequest {
Name = "theName",
BillingFrequency = "theBillingFrequency",
CurrencyIsoCode = "theCurrencyIsoCode",
Price = "the_price",
AddOns = new AddOnsRequest {
Add = new AddAddOnRequest[] {
new AddAddOnRequest {
InheritedFromId = "add_on_id_1",
Amount = 20.00M,
NumberOfBillingCycles = 2,
Name = "NewName",
Description = "NewDescription"
}
},
Update = new UpdateAddOnRequest[] {
new UpdateAddOnRequest {
ExistingId = "add_on_id_2",
Amount = 15.00M,
NumberOfBillingCycles = 2,
Name = "NewName",
Description = "NewDescription"
}
}
},
Discounts = new DisccountsRequest {
Add = new AddDiscountRequest[] {
new AddDiscountRequest {
InheritedFromId = "discount_id_1",
Amount = 20.00M,
NumberOfBillingCycles = 2,
Name = "NewName",
Description = "NewDescription"
}
},
Update = new UpdateDscountRequest[] {
new UpdateDscountRequest {
ExistingId = "discount_id_2",
Amount = 15.00M,
NumberOfBillingCycles = 2,
Name = "NewName",
Description = "NewDescription"
}
}
}
};
Result<plan> result = gateway.Plan.Create(request);