App reviews, troubleshooting, and recommendations
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I am trying to use the subscriptionContractAtomicCreate mutation in an app I am developing. I have worked through the payloads to make the request, as I was initially receiving actionable userError messages to help refine the payload. Unfortunately I am now at the point where I just receive a generic "is invalid" userError message.
Using api version 2024/04
I am using a customer created for the dev store, in addition to a product (variant id) also created in the dev store. I am following the example in the documentation (for this api version).
Possible issues I can think of, but would like some clarity on:
1. I do not have is a paymentMethodId as this is a dev store, and a "Bogus Gateway" checkout does not seem to create one on the customer. However I do not see any validation error regarding this in the response (nor is it required, following the docs).
2. The app already has included the scope: write_own_subscription_contracts. But I am unclear from the docs what this means: "Also: The user must have manage_orders_information permission" - Does the app need to include manage_orders_information as a scope as well?
Query below (customer info removed):
const q = /* GraphQL */ `
mutation {
subscriptionContractAtomicCreate(
input: {
customerId: "gid://shopify/Customer/8330005283091"
nextBillingDate: "2024-07-16"
currencyCode: USD
lines: [
{
line: {
productVariantId: "gid://shopify/ProductVariant/49498192740627"
quantity: 20
currentPrice: 25.0
}
}
]
contract: {
status: ACTIVE
billingPolicy: { interval: MONTH, intervalCount: 1, minCycles: 3 }
deliveryPolicy: { interval: MONTH, intervalCount: 1 }
deliveryPrice: 14.99
deliveryMethod: {
shipping: {
address: {
firstName: "----"
lastName: "----"
address1: "----"
city: "----"
provinceCode: "---"
countryCode: US
zip: "----"
}
}
}
}
}
) {
contract {
id
}
userErrors {
field
message
code
}
}
}
`;
Solved! Go to the solution
This is an accepted solution.
Update 2 - it looks like you must pass a paymentMethodId in the payload to create a subscription. If it is missing, you get the generic error message.
Update: it looks like `manage_orders_information` isn't a scope I can add to my app, so I don't believe this is the issue here
This is an accepted solution.
Update 2 - it looks like you must pass a paymentMethodId in the payload to create a subscription. If it is missing, you get the generic error message.