stripe_plan: Plan Object

stripe_planR Documentation

Plan Object

Description

The stripe_plan object represents the complete set of data required to manage subscription plans at Stripe. A subscription plan contains the pricing and billing information to be charged for differen features or products. With different plans, customers can be charged differently for different services or levels.

Format

An R6 Class object

Methods

  • create: Creates a plan on Stripe. Required arguments are:

    • id: The id of the plan

    • name: Display name of the plan

    • amount: The amount of the plan in cents. So a $4.99 plan is 499

    • currency: The currency for the amount

    • interval: The billing interval for the plan. Should be one of day, week, month, year.

  • retrieve: Retrieves plan information from Stripe based on the id passed to the method.

  • update: Updates plan information at Stripe. Using this method the plan name, statement descriptor, trial days and metadata properties can be updated.

  • delete: Deletes the plan with the provided id at Stripe.

Methods

Public methods


Method new()

Usage
stripe_plan$new(..., metadata = list())

Method create()

Usage
stripe_plan$create(
  id,
  amount,
  currency,
  interval,
  nickname,
  interval_count = NULL,
  metadata = list(),
  product = NULL,
  trial_period_days = NULL
)

Method retrieve()

Usage
stripe_plan$retrieve(plan_id)

Method update()

Usage
stripe_plan$update(
  metadata = NULL,
  nickname = NULL,
  product = NULL,
  trial_period_days = NULL
)

Method delete()

Usage
stripe_plan$delete(plan_id)

Method clone()

The objects of this class are cloneable with this method.

Usage
stripe_plan$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# Create Test Plan 1 with a monthly charge of $9.99
new_plan <- stripe_plan$new()
new_plan$create(id = "testPlan1", name = "Test Plan 1", amount = 999,
                currency = "usd", interval = "month")

# Retrieve and update a plan name
my_plan <- stripe_plan$new()
my_plan$retrieve("testPlan1")
my_plan$update(name = "My Test Plan")

# Delete plan with id "testPlan1".
delete_plan <- stripe_plan$new()
delete_plan$delete("testPlan1")


MrDAndersen/stRipe documentation built on March 17, 2024, 7:25 p.m.