Subscriptions
Subscriptions list
GET “https://app.ongoingsubscriptions.com/api/v1/subscriptions”
Description
Get a paginated list of all Subscriptions.
Request Params
- status: REQUIRED
enum['ACTIVE', 'CANCELLED', 'PAUSED', 'EXPIRED', 'FAILED']
- page:
number
Example Response
{
"subscriptions": [
{
"uuid": "a9dd6766-9dd8-11ec-88cc-0242ac130003",
"billingPolicy": {
"anchors": [],
"interval": "MONTH",
"intervalCount": 1,
"maxCycles": null,
"minCycles": null
},
"deliveryMethod": {
"shippingOption": {
"title": "Economy",
"presentmentTitle": "Economy",
"description": null,
"code": "Economy"
}
},
"deliveryPolicy": {
"anchors": [],
"interval": "MONTH",
"intervalCount": 1
},
"customer": {
"shopifyId": "gid://shopify/Customer/12345",
"firstName": "Leonardo",
"fullName": "Leonardo da Vinci",
"paymentMethodId": "gid://shopify/CustomerPaymentMethod/67342c35daf453460251a"
},
"lastPaymentStatus": null,
"nextBillingDate": "2022-04-03 01:00:00",
"shopifyId": "gid://shopify/SubscriptionContract/12345",
"status": "ACTIVE",
"createdAt": "2022-03-03T02:21:45.000000Z",
"updatedAt": "2022-03-18T07:00:00.000000Z"
},
{
"uuid": "b0b31f9a-9dd8-11ec-8314-0242ac130003",
"billingPolicy": {
"anchors": [],
"interval": "YEAR",
"intervalCount": 1,
"maxCycles": null,
"minCycles": null
},
"deliveryMethod": {
"shippingOption": {
"title": "Economy",
"presentmentTitle": "Economy",
"description": null,
"code": "Economy"
}
},
"deliveryPolicy": {
"anchors": [],
"interval": "MONTH",
"intervalCount": 4
},
"customer": {
"shopifyId": "gid://shopify/Customer/23456",
"firstName": "Leonardo",
"fullName": "Leonardo da Vinci"
},
"lastPaymentStatus": null,
"nextBillingDate": "2023-03-05 12:00:00",
"shopifyId": "gid://shopify/SubscriptionContract/23456",
"status": "ACTIVE"
}
],
"pagination": {
"hasNextPage": true,
"lastPage": 2,
"page": 1,
"totalResults": 16
},
"message": "Subscriptions fetched successfully.",
"errors": false
}
Single subscription
GET “https://app.ongoingsubscriptions.com/api/v1/subscriptions/{uuid}”
Description
Get a paginated list of all Subscriptions
Url Params
- uuid: REQUIRED
uuid
Example Response
{
"subscription": {
"billingAttempts": [],
"lines": [
{
"id": "gid://shopify/SubscriptionLine/2de6e225-7689-4b9f-97a0-7507fe011344",
"sellingPlanName": "Monthly subscription",
"title": "Subscription product #2",
"variantTitle": "-",
"quantity": 1,
"variantId": "gid://shopify/ProductVariant/6543",
"productId": "gid://shopify/Product/2345",
"sku": "",
"variantImage": {
"originalSrc": "https://cdn.shopify.com/s/files/1/missing.jpg"
},
"currentPrice": {
"amount": "12.6",
"currencyCode": "USD"
},
"lineDiscountedPrice": {
"amount": "12.6",
"currencyCode": "USD"
}
},
{
"id": "gid://shopify/SubscriptionLine/d91369f4-a166-4cf4-a84c-a355164dd1d6",
"sellingPlanName": "Monthly subscription",
"title": "Subscription product",
"variantTitle": "-",
"quantity": 1,
"variantId": "gid://shopify/ProductVariant/1234",
"productId": "gid://shopify/Product/4321",
"sku": "",
"variantImage": {
"originalSrc": "https://cdn.shopify.com/s/files/1/missing.jpg"
},
"currentPrice": {
"amount": "11.7",
"currencyCode": "USD"
},
"lineDiscountedPrice": {
"amount": "11.7",
"currencyCode": "USD"
}
}
],
"nextBillingDate": "2023-10-21T12:00:00Z",
"billingPolicy": {
"interval": "MONTH",
"intervalCount": 2,
"minCycles": 6,
"maxCycles": null
},
"deliveryPolicy": {
"interval": "MONTH",
"intervalCount": 2
},
"deliveryMethod": {
"address": {
"address1": "1234 Roma Road",
"address2": "",
"city": "Rome",
"company": null,
"country": "Italy",
"countryCode": "IT",
"firstName": "Leonardo",
"lastName": "da Vinci",
"name": "Leonardo da Vinci",
"phone": null,
"province": "Rome",
"provinceCode": "IT",
"zip": "98765-321"
}
},
"status": "ACTIVE",
"id": "gid://shopify/SubscriptionContract/54321",
"currencyCode": "USD",
"createdAt": "2022-03-14T18:27:01Z",
"lastPaymentStatus": null,
"originOrder": {
"createdAt": "2022-03-14T18:27:00Z",
"name": "#1051"
},
"customer": {
"id": "gid://shopify/Customer/6077936828652",
"firstName": "Leonardo",
"displayName": "Leonardo da Vinci",
"defaultAddress": {
"address1": "1234 Roma Road",
"address2": "",
"city": "Rome",
"province": "Rome",
"country": "Italy",
"zip": "98765-321"
}
}
},
"message": "Subscription data fetched successfully.",
"errors": false
}
Change subscription status
PUT “https://app.ongoingsubscriptions.com/api/v1/subscriptions/{uuid}/status”
Description
Update the status of a single subscription
Url Params
- uuid: REQUIRED
uuid
Request Params
- status: REQUIRED
enum['ACTIVE', 'CANCELLED', 'PAUSED', 'EXPIRED', 'FAILED']
Example Response
{
"subscription": {
"uuid": "b0b31f9a-9dd8-11ec-8314-0242ac130003",
"status": "ACTIVE"
},
"message": "Subscription status updated successfully.",
"errors": false
}
Add line item
PUT “https://app.ongoingsubscriptions.com/api/v1/subscriptions/{uuid}/line-item”
Description
Add a new line item to the subscription
Url Params
- uuid: REQUIRED
uuid
Request Params
- productVariantId: REQUIRED
shopifyId
Example: gid://shopify/ProductVariant/123456
- quantity: REQUIRED
number
Example: 2
Example Response
{
"message": "Line item added successfully.",
"errors": false
}
Remove line item
DELETE “https://app.ongoingsubscriptions.com/api/v1/subscriptions/{uuid}/line-item”
Description
Remove a line item from a subscription.
Url Params
- uuid: REQUIRED
uuid
Request Params
- lineItemId: REQUIRED
shopifyId
Example: gid://shopify/SubscriptionLine/2de6e225-7689-4b9f-97a0-7507fe011344
Example Response
{
"message": "Line item removed successfully.",
"errors": false
}