stripe_subscription: Subscription object

stripe_subscriptionR Documentation

Subscription object

Description

The stripe_subscription object represents the data and methods needed to manage customer subscriptions. Subscriptions allow you to charge a customer's card on a recurring basis. A subscription ties a customer to a particular plan that was previously created.

Format

An R6 Class object

Methods

  • create: Creates a subscription for a customer on Stripe. Required arguments are:

    • plan_id: The id of the plan that the customer is subscribing to

    • customer_id: The id of the customer that the subscription should be created for.

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

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

  • cancel: Cancels the subscription with the provided id at Stripe.

Methods

Public methods


Method new()

Usage
stripe_subscription$new(..., plan = NULL, metadata = list())

Method create()

Usage
stripe_subscription$create(
  plan_id,
  customer_id,
  card_token = NULL,
  exp_month = NULL,
  exp_year = NULL,
  number = NULL,
  cvc = NULL,
  name = NULL,
  address_city = NULL,
  address_country = NULL,
  address_line1 = NULL,
  address_line2 = NULL,
  address_state = NULL,
  address_zip = NULL,
  currency = NULL,
  default_for_currency = NULL,
  card_metadata = list(),
  coupon = NULL,
  items = list(),
  application_fee_percent = NULL,
  quantity = NULL,
  tax_percent = NULL,
  trial_end = NULL,
  trial_period_days = NULL
)

Method retrieve()

Usage
stripe_subscription$retrieve(sub_id)

Method update()

Usage
stripe_subscription$update(
  plan = NULL,
  cancel_at_period_end = NULL,
  coupon = NULL,
  items = list(),
  prorate = NULL,
  proration_date = NULL,
  source = NULL,
  application_fee_percent = NULL,
  metadata = list(),
  tax_percent = NULL,
  trial_end = NULL
)

Method cancelSub()

Usage
stripe_subscription$cancelSub()

Method clone()

The objects of this class are cloneable with this method.

Usage
stripe_subscription$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


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