subscriptions

List subscriptions with cursor pagination and filters
View as Markdown

The subscriptions query returns SubscriptionConnection.

Arguments

ArgumentTypeRequiredDescription
afterStringNoCursor to paginate forward from.
beforeStringNoCursor to paginate backward from.
customerStringNoFilter by customer ID.
firstIntNoReturn the first N results.
lastIntNoReturn the last N results.
liveBooleanNoFilter by subscription status. Requires a customer scope (customer auth or customer argument).
productGroupStringNoFilter subscriptions whose product belongs to a ProductGroup with this name.

Return type: SubscriptionConnection

FieldTypeRequired
edges[SubscriptionEdge!]!Yes
pageInfoPageInfo!Yes

Examples

List customer subscriptions

Retrieve all subscriptions for a customer with product info

1query {
2 subscriptions(customer: "cust123", first: 25) {
3 edges {
4 node {
5 publicId
6 every
7 everyPeriod
8 quantity
9 price
10 live
11 startDate
12 product {
13 name
14 externalProductId
15 sku
16 imageUrl
17 }
18 }
19 }
20 }
21}

List subscriptions with pagination

Page through a customer’s subscriptions using cursor-based pagination

1query {
2 subscriptions(customer: "cust123", first: 10, after: "cursor123") {
3 edges {
4 cursor
5 node {
6 publicId
7 every
8 everyPeriod
9 quantity
10 price
11 live
12 startDate
13 }
14 }
15 pageInfo {
16 hasNextPage
17 hasPreviousPage
18 startCursor
19 endCursor
20 }
21 }
22}

List subscriptions with delivery details

Subscriptions with shipping address and payment info

1query {
2 subscriptions(customer: "cust123", first: 25) {
3 edges {
4 node {
5 publicId
6 every
7 everyPeriod
8 quantity
9 price
10 live
11 cancelled
12 shippingAddress {
13 firstName
14 lastName
15 address
16 city
17 stateProvinceCode
18 zipPostalCode
19 }
20 payment {
21 ccType
22 ccNumberEnding
23 paymentMethod
24 }
25 product {
26 name
27 externalProductId
28 sku
29 }
30 }
31 }
32 }
33}

List subscriptions with prepaid status

Subscriptions with prepaid context for tracking remaining orders

1query {
2 subscriptions(customer: "cust123", first: 25) {
3 edges {
4 node {
5 publicId
6 every
7 everyPeriod
8 quantity
9 price
10 live
11 product {
12 name
13 externalProductId
14 sku
15 }
16 prepaidSubscriptionContext {
17 prepaidOrdersRemaining
18 prepaidOrdersPerBilling
19 renewalBehavior
20 lastRenewalRevenue
21 prepaidOriginMerchantOrderId
22 }
23 }
24 }
25 }
26}