Querying Current Discount on Recurring Charge

Solved

Querying Current Discount on Recurring Charge

Y_abregu
Shopify Partner
3 0 0

Good morning,

 

I implemented the 'Recurring charge discounts' on a development store, using this guide (Recurring charge discounts (shopify.dev)) and managed to get a proper response.

 

Y_abregu_0-1659534446932.png

But if I want to check if it was correctly applied, I don't seem to find it on the dashboard as explained on the documentation.

The merchant invoice displays the discounted price but the Partner Dashboard shows the full price (without the discount)

Is there an API or GraphQL query that I can run, to check that this discount has been applied?

 

 

Accepted Solution (1)

dewyze
Shopify Staff
10 1 1

This is an accepted solution.

Hi @Y_abregu !

Sorry for the delay, there is some ambiguity in "Subscriptions" as the team that handles billing subscriptions for app developers is different than for merchants who are selling subscriptions to customers. I had to track down the right team the help out.

 

Here is the response I got:

 

The most straightforward way to query for the discount applied to the subscription would be using the queries in the docs here and modifying the GQL query to also include the priceAfterDiscount.

 

query {
  node(id: "gid://shopify/AppSubscription/1") {
    ...on AppSubscription {
      createdAt
      currentPeriodEnd
      id
      name
      status
      test
      lineItems {
        plan {
          pricingDetails {
            ...on AppRecurringPricing {
              interval
              price {
                amount
                currencyCode
              }
              discount {
                priceAfterDiscount {
                  amount
                }
              }
            }
            ...on AppUsagePricing {
              terms
              cappedAmount {
                amount
                currencyCode

              }
              balanceUsed {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
}

Does this address your concern?

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

dewyze
Shopify Staff
10 1 1

This is an accepted solution.

Hi @Y_abregu !

Sorry for the delay, there is some ambiguity in "Subscriptions" as the team that handles billing subscriptions for app developers is different than for merchants who are selling subscriptions to customers. I had to track down the right team the help out.

 

Here is the response I got:

 

The most straightforward way to query for the discount applied to the subscription would be using the queries in the docs here and modifying the GQL query to also include the priceAfterDiscount.

 

query {
  node(id: "gid://shopify/AppSubscription/1") {
    ...on AppSubscription {
      createdAt
      currentPeriodEnd
      id
      name
      status
      test
      lineItems {
        plan {
          pricingDetails {
            ...on AppRecurringPricing {
              interval
              price {
                amount
                currencyCode
              }
              discount {
                priceAfterDiscount {
                  amount
                }
              }
            }
            ...on AppUsagePricing {
              terms
              cappedAmount {
                amount
                currencyCode

              }
              balanceUsed {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
}

Does this address your concern?

To learn more visit the Shopify Help Center or the Community Blog.

Y_abregu
Shopify Partner
3 0 0

Yes, thanks. Just a couple of notes. I used this query

<<-QUERY
          {
            node(id: "gid://shopify/AppSubscription/#{shop.current_recurring_application_charge.id}") {
              ... on AppSubscription {
                id
                name
                lineItems {
                  plan {
                    pricingDetails {
                      ... on AppRecurringPricing {
                        discount {
                          value{
                            ... on AppSubscriptionDiscountPercentage{
                              percentage
                            }
                          }
                          priceAfterDiscount {
                            amount
                            currencyCode
                          }
                          durationLimitInIntervals
                          remainingDurationInIntervals
                        }
                        interval
                        price {
                          amount
                          currencyCode
                        }
                      }
                    }
                  }
                }
              }
            }
          }

        QUERY

To get the exact percentage used, rather than calculate it after getting the priceAfterDiscount amount

 

Also, the ...on returns an error, the correct way , for me at least, was ... on (with space)