Plan: Create
- Java
PlanRequest request = new PlanRequest()
.name("the_name")
.billingFrequency("the_billing_frequency")
.currencyIsoCode("the_currency_iso_code")
.price(new BigDecimal("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(ā¦)arrayArray of add-ons to add to the plan.
.amount(ā¦)BigDecimalPrice of the add-on. This will override the inherited add-on amount.
.description(ā¦)stringA description of the add-on.
.inheritedFromId(ā¦)stringSpecify an add-on ID to apply to the pan. You can't duplicate an add-on for a plan, but you can update the quantity.
.name(ā¦)stringThe name of the add-on.
Number of billing cycles to apply the add-on. It must be greater than 0.
.remove(ā¦)arrayArray of add-on IDs that are associated with the subscription. IDs specified will be removed from the plan.
.update(ā¦)arrayArray of add-ons that are associated with the plan.
.amount(ā¦)BigDecimalPrice of the add-on. This will override the inherited add-on amount.
.description(ā¦)stringA description of the add-on.
.existingId(ā¦)stringUpdate a particular add-on by specifying the add-on ID.
.name(ā¦)stringThe name of the add-on.
Number of billing cycles to apply the add-on. It must be greater than 0.
.billingDayOfMonth(ā¦)integer or stringThe value that specifies the day of the month that the gateway will charge the subscription on every billing cycle.
.billingFrequency(ā¦)integer or stringSpecifies the billing interval of the plan.
.currencyIsoCode(ā¦)stringThe currency for the transaction. The three-letter alphabetic codes for the transaction's currency (e.g. "USD" for US dollars).
.description(ā¦)stringA description of the plan.
A collection of discounts associated with this plan. Discount details can only be managed within the Control Panel.
.add(ā¦)arrayArray of discounts to add to the plan.
.amount(ā¦)BigDecimalPrice of the discount. This will override the inherited discount amount.
.description(ā¦)stringA description of the discount.
.inheritedFromId(ā¦)stringSpecify a discount ID to apply to the plan. You can't duplicate an discount for a plan, but you can update the quantity.
.name(ā¦)stringThe name of the discount.
Number of billing cycles to apply the discount. It must be greater than 0.
.remove(ā¦)arrayArray of discount IDs that are associated with the subscription. IDs specified will be removed from the plan.
.update(ā¦)arrayArray of discounts that are associated with the plan.
.amount(ā¦)BigDecimalPrice of the discount. This will override the inherited discount amount.
.description(ā¦)stringA description of the discount.
.existingId(ā¦)stringUpdate a particular discount by specifying the discount ID.
.name(ā¦)stringThe name of the discount.
Number of billing cycles to apply the discount. It must be greater than 0.
.id(ā¦)stringA string value representing a specific plan. Max 36 characters; must be unique within a merchant's Vault; valid characters are letters, numbers, - and _. If not specified on creation, the gateway will generate an alphanumeric ID that can be accessed on the result. The generated IDs will never start with a leading 0 and are case-insensitive.
.modificationTokens(ā¦)stringThe collection of Modification Tokens associated with a plan. A modification is an add_on or a discont. So modification tokens can be passed to assiciate with a plan when creating the plan.
.name(ā¦)stringThe name of the plan.
.neverExpires(ā¦)boolean or stringWhether a subscription's billing cycle is set to never expire, or to run for a specific number of billing cycles.
.numberOfBillingCycles(ā¦)integer or stringSpecifies the number of billing cycles of the plan.
.price(ā¦)decimal or stringThe base price specified for a plan, formatted like "10" or "10.00".
The 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(ā¦)stringThe trial unit specified in a plan. Specify
day or month..trialPeriod(ā¦)booleanA 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.
- Java
string[] modification_tokens = {"modification1_token", "modification2_token"};
PlanRequest 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.
- Java
PlanRequest request = new PlanRequest()
.name("the_name")
.billingFrequency("TheBillingFrequency")
.currencyIsoCode(theCurrencyIsoCode")
.price("the_price")
.addOns()
.add()
.inheritedFromId("add_on_id_1")
.amount(new BigDecimal("20.00"))
.done()
.add()
.inheritedFromId("add_on_id_2")
.amount(new BigDecimal("30.00"))
.done()
.discounts()
.add()
.inheritedFromId("discount_id_1")
.amount(new BigDecimal("7.00"))
.done()
Result<Plan> result = gateway.plan().create(request);- amount
- numberOfBillingCycles
- name
- description
- Java
PlanRequest request = new PlanRequest()
.name("the_name")
.billingFrequency("TheBillingFrequency")
.currencyIsoCode(theCurrencyIsoCode")
.price("the_price")
.addOns()
.add()
.inheritedFromId("add_on_id_1")
.amount(new BigDecimal("20.00"))
.done()
.add()
.inheritedFromId("add_on_id_2")
.amount(new BigDecimal("30.00"))
.done()
.discounts()
.add()
.inheritedFromId("discount_id_1")
.amount(new BigDecimal("7.00"))
.done()
Result<Plan> result = gateway.plan().create(request);