Shopify's recent July 2020 API update allows billing annually for apps, so I've been trying to add the option to choose between monthly and annual billing to my app.
I've been trying to do this by modifying the GraphQL call that creates the billing plan.
I've been trying several different options, but the most logical one seems to be to add an additional line item. This works in rendering both plans to the billing approval screen, but it is still not possible to actually choose between plans (details for both plans are displayed, but only the latter option is actually effective.
Here's the code I've been working with:
const query = JSON.stringify({
query: `mutation {
appSubscriptionCreate(
name: "Basic Plan"
trialDays: 7
returnUrl: "${process.env.HOST}"
lineItems: [
{
plan: {
appRecurringPricingDetails: {
price: { amount: 4.99, currencyCode: USD }
}
}
plan: {
appRecurringPricingDetails: {
price: { amount: 49.99, currencyCode: USD }
interval: ANNUAL
}
}
}
]
) {
userErrors {
field
message
}
confirmationUrl
appSubscription {
id
}
}
}`
});
I'd be happy about any suggestions.
Thanks a lot!