Subscriptions Collection


List Subscriptions

  GET https://api.zype.com/subscriptions/?page=page&per_page=per_page

Parameters

Parameter Function Type
braintree_id Filter records by a Braintree ID String
consumer_id Filter records by a Consumer ID String
created_at Filter records by created date using times in ISO8601 format (Example: 2017-01-01T00:00:00-00:00) or Unix timestamps (Example: 1483228800)
Note: Range filters can be applied by adding a suffix: ‘.gt’, ‘.gte’, ‘.lt’, ‘lte’ (Example: created_at.gte)
Date
id Filter records by ID String
id! Exclude records by ID String
order Sort records in ascending or descending order (Example: asc/desc) String
page The page number of records to return (Example: 1) Integer
per_page The number of records to return (Example: 10) Integer
plan_id Filter records by a Plan ID String
q Filter records by keyword String
sort Sort records on the specified field String
stripe_id Filter records by a Stripe ID String

Create a Subscription

  POST https://api.zype.com/subscriptions/{subscription}

Parameters

Parameter Function Type
subscription[consumer_id] The id of the consumer to be subscribed required String
subscription[plan_id] The id of the plan the consumer is subscribing to required String
subscription[third_party_id] The id of a third party plan. required if not using braintree or stripe.
Note: third_party_id can’t have unicode characters in the name. Only alphanumeric characters are allowed (Example: apple123)
String
subscription[coupon_code] The code of the coupon, if used. This parameter is optional. String
subscription[stripe_card_token] The Stripe credit card token as generated by a Stripe payment form String
subscription[stripe_id] The id of a Stripe subscription that has already been fully created (used for reconciling the Zype dashboard with subscriptions that have been previously created) String
subscription[braintree_payment_nonce] The Braintree credit card payment nonce as generated by a Braintree payment form String
subscription[braintree_id] The id of a Braintree subscription that has already been fully created (used for reconciling the Zype dashboard with subscriptions that have been previously created) String
subscription[status] Valid values are ‘canceled’ or ‘active’. If left empty, ‘active’ will be the default value. String
subscription[cancelled_at] If the subscription has already been cancelled at a certain date (optional) String
subscription[cancel_at_period_end] Set Stripe subscription to cancel at period end (optional) String
subscription[current_period_start_at] Set the beginning of the subscription period.
Only applies to third party subscriptions (third_party_id field should be present).
Either current_period_start_at or current_period_end_at should be set, but not both.
String
subscription[current_period_end_at] Set the end of the subscription period.
Only applies to third party subscriptions (third_party_id field should be present).
Either current_period_start_at or current_period_end_at should be set, but not both.
String

Retrieve a Subscription

  GET https://api.zype.com/subscriptions/{id}

Parameters

Parameter Function Type
id ID of the record to retrieve (Example: 5389352e69702d401b000000) String

Update a Subscription

  PUT https://api.zype.com/subscriptions/{id}

Parameters

Parameter Function Type
subscription[consumer_id] The id of the consumer String
subscription[plan_id] The id of the plan the consumer is subscribing to String
subscription[coupon_code] The code of the coupon, if used String
subscription[stripe_card_token] The Stripe credit card token as generated by a Stripe payment form String
subscription[stripe_id] The id of a Stripe subscription that has already been fully created (used for reconciling the Zype dashboard with subscriptions that have been previously created) String
subscription[braintree_payment_nonce] The Braintree credit card payment nonce as generated by a Braintree payment form String
subscription[braintree_id] The id of a Braintree subscription that has already been fully created (used for reconciling the Zype dashboard with subscriptions that have been previously created) String
subscription[status] Valid values are ‘canceled’ or ‘active’ String
subscription[cancelled_at] If the subscription has already been cancelled at a certain date String
subscription[cancel_at_period_end] Set Stripe subscription to cancel at period end String
subscription[current_period_start_at] Set the beginning of the subscription period.
Only applies to third party subscriptions (third_party_id field should be present).
Either current_period_start_at or current_period_end_at should be set, but not both.
String
subscription[current_period_end_at] Set the end of the subscription period.
Only applies to third party subscriptions (third_party_id field should be present).
Either current_period_start_at or current_period_end_at should be set, but not both.
String

Delete a Subscription

DELETE https://api.zype.com/subscriptions/{id}

Parameters

Parameter Function Type
id ID of the record to delete (Example: 5389352e69702d401b000000) String

Subscription Object

  {
    "response": {
      "_id": "56fecbcbf28347637b00001e",
      "_keywords": [
        "braintree",
        "com",
        "month"
      ],
      "amount": "5.0",
      "braintree_id": "6fh5yw",
      "braintree_payment_nonce": "ff7f20cb-a7ca-44b0-92d9-3a298d1da184",
      "cancel_at_period_end": false,
      "cancelled_at": null,
      "consumer_id": "56f99f18f2834738c800000b",
      "coupon_code": null,
      "created_at": "2016-04-01T15:28:11.970-04:00",
      "currency": "USD",
      "current_period_end_at": "2016-04-30T00:00:00.000-04:00",
      "current_period_start_at": "2016-04-01T00:00:00.000-04:00",
      "deleted_at": null,
      "discount_amount": null,
      "discount_duration": null,
      "discount_duration_months": null,
      "discount_percent": null,
      "interval": "month",
      "interval_count": 1,
      "mrr": 5,
      "plan_id": "5671a8394d656c49a7000000",
      "site_id": "5468fd6569702d17ee500000",
      "start_at": "2016-04-01T15:28:14.000-04:00",
      "status": "active",
      "trial_period_days": 0,
      "updated_at": "2016-04-01T15:28:11.970-04:00",
      "plan_name": "Braintree Month"
    }
  }