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:
-
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).
-
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
}
}
}
`;