Subscription endpoints

GET List subscriptions

https://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/subscriptions.json

Fetch a list of the current customer's active subscriptions

ParameterNameRequiredTypeDescription
Pathcustomer_idYesintegerID of the currently logged in customer.

Response:

{
  "data": [
    {
      "id": "63594867",
      "type": "subscription",
      "attributes": {
        "status": "active",
        "created_at": "2019-05-01T05:14:27.441Z",
        "cancelled_at": null,
        "paused_at": null,
        "note": "",
        "customer_name": "Jane Doe",
        "customer_email": "[email protected]",
        "billing_address": {
          "zip": "3000",
          "city": "Melbourne",
          "name": "Jane Doe",
          "phone": null,
          "company": null,
          "country": "Australia",
          "address1": "100 Main Street",
          "address2": "",
          "latitude": null,
          "province": "Victoria",
          "last_name": "Doe",
          "longitude": null,
          "first_name": "Jane",
          "country_code": "AU",
          "province_code": "VIC"
        },
        "frequency": "42_days",
        "frequency_human": "Every 6 weeks",
        "line_items": {
          "data": [
            {
              "id": "40850",
              "type": "subscription_line_item",
              "attributes": {
                "product_id": 1506703278149,
                "variant_id": 13587185303621,
                "quantity": 5,
                "price": "8.90",
                "properties": null,
                "title": "Beauty Berry Porridge"
              }
            },
            {
              "id": "40851",
              "type": "subscription_line_item",
              "attributes": {
                "product_id": 1506738864197,
                "variant_id": 13587544539205,
                "quantity": 1,
                "price": "15.90",
                "properties": [
                  {
                    "name": "_applied_subscription_discount",
                    "value": "135"
                  }
                ],
                "title": "Kids Blendies"
              }
            }
          ]
        },
        "shipping_method": {
          "data": {
            "id": "84573",
            "type": "subscription_shipping_method",
            "attributes": {
              "note": null,
              "shipping_rates": [
                {
                  "id": 851467108421,
                  "code": "Standard Shipping (3-6 days)",
                  "phone": null,
                  "price": "0.00",
                  "title": "Standard Shipping (3-6 days)",
                  "source": "shopify",
                  "discounted_price": "0.00"
                }
              ],
              "shipping_address": {
                "first_name": "Jane",
                "last_name": "Doe",
                "address1": "100 Main Street",
                "address2": "",
                "city": "Melbourne",
                "zip": "3000",
                "province": "Victoria",
                "province_code": "VIC",
                "country": "Australia"
              }
            }
          }
        },
        "payment_method": {
          "data": {
            "id": "349580",
            "type": "customer_payment_method",
            "attributes": {
              "status": "active",
              "payment_data": {
                "brand": "Visa",
                "last4": "4242",
                "exp_year": 2024,
                "exp_month": 4,
                "processor": "stripe"
              },
              "payment_method_type": "credit-card",
              "authorized_payment_method_id": 235252
            }
          }
        },
        "next_scheduled_order": {
          "data": {
            "id": "12521",
            "type": "subscription_order",
            "attributes": {
              "status": "scheduled",
              "shipping_rate": {},
              "scheduled_at": "2019-05-18T00:00:00.000Z",
              "processed_at": null,
              "skipped_at": null,
              "cancelled_at": null,
              "order_id": null,
              "sequential_id": 2,
              "shopify_url": "#",
              "order_line_items": {
                "data": [
                  {
                    "id": "35625",
                    "type": "subscription_order_line_item",
                    "attributes": {
                      "subscription_order_id": 12521,
                      "product_id": 1506703278149,
                      "variant_id": 13587185303621,
                      "quantity": 5,
                      "price": "8.90",
                      "properties": []
                    }
                  },
                  {
                    "id": "35624",
                    "type": "subscription_order_line_item",
                    "attributes": {
                      "subscription_order_id": 12521,
                      "product_id": 1506738864197,
                      "variant_id": 13587544539205,
                      "quantity": 1,
                      "price": "15.90",
                      "properties": [
                        {
                          "name": "_applied_subscription_discount",
                          "value": "135"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}

PATCH Update existing subscription

https://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/subscriptions/{{ id }}.json

Update an existing subscription belonging to the current customer.

ParameterNameRequiredTypeDescription
Pathcustomer_idYesintegerID of the currently logged in customer.
PathidYesintegerID of the subscription to update.

DELETE Delete existing subscription

https://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/subscriptions/{{ id }}.json

Remove an existing subscription belonging to the current customer.

ParameterNameRequiredTypeDescription
Pathcustomer_idYesintegerID of the currently logged in customer.
PathidYesintegerID of the subscription to update.