For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hey,
I'm following these steps: https://shopify.dev/tutorials/migrate-existing-subscription-contracts-to-shopify
When I execute the mutation giving the (Shopify) CustomerId, stripeCustomerId and stripePaymentMethodId, I get back a PaymentMethod object so I thought it worked. But when I try to query the same customer for their paymentMethods, I don't get any Payment Methods back
Any help on this will be great, thanks!
Update: I changed up my mutation and now I'm getting an internal error, this is the mutation and the Request ID:
Mutation:
mutation customerPaymentMethodRemoteCreditCardCreate($customerId: ID!, $stripeCustomerId: String!, $stripePaymentMethodId: String) {
customerPaymentMethodRemoteCreditCardCreate(
customerId: $customerId,
stripeCustomerId: $stripeCustomerId,
stripePaymentMethodId: $stripePaymentMethodId
) {
customerPaymentMethod {
id
instrument {
... on CustomerCreditCard {
billingAddress {
address1
city
country
countryCode
province
provinceCode
zip
}
brand
expiresSoon
expiryMonth
expiryYear
firstDigits
isRevocable
lastDigits
maskedNumber
name
}
}
}
userErrors {
code
field
message
}
}
}
Request ID: 8949ed40-6b4b-45bc-9f51-f02428f0c1bc (include this in support requests)
For context in the above update, the mutation was executed on a development store using Shopify Payments in test mode and used Stripe's test mode customer source (which referenced a test card from Stripe).
Update 2:
I changed the mutation to match the one from the link above:
Mutation:
mutation customerPaymentMethodRemoteCreditCardCreate($customerId: ID!, $stripeCustomerId: String!, $stripePaymentMethodId: String) {
customerPaymentMethodRemoteCreditCardCreate(
customerId: $customerId,
stripeCustomerId: $stripeCustomerId,
stripePaymentMethodId: $stripePaymentMethodId
) {
customerPaymentMethod {
id
instrument {
... on CustomerCreditCard {
brand
lastDigits
}
}
}
userErrors {
code
field
message
}
}
}
This time I used a real card and was able to see the payment method on Shopify Admin, but when trying to query for the customer's payment methods, I get an internal error:
Query:
query getCustomerPaymentMethods($customerId: ID!) {
customer(id: $customerId) {
paymentMethods(first: 1) {
edges {
node {
id
instrument {
... on CustomerPaymentInstrument {
... on CustomerCreditCard {
billingAddress {
address1
city
country
countryCode
province
provinceCode
zip
}
brand
expiresSoon
expiryMonth
expiryYear
firstDigits
isRevocable
lastDigits
maskedNumber
name
}
}
}
revokedAt
}
}
}
}
}
Request Id: a3f50964-7ee5-496f-86fd-28fabc8a955b
Hello KTNinja,
The error you encounter is because we do not support a secondary test gateway at the moment unfortunately. As such we cannot really recommend testing the API.
If you really wanted to, Stripe could be setup in a production environment to test your mutation, with a real credit card.
Thanks!
To learn more visit the Shopify Help Center or the Community Blog.
Hey @Poulping,
Thanks for the quick response!
I tried again in a production environment and turning off test mode for Shopify Payments, and used a real credit card from Stripe (using its Stripe payment method id). I still get the same behaviour as before where I can see the card in Admin but get an internal error when trying to query the customer's payment methods.
Request ID: e4b1ba6c-bd0d-4946-853f-afeeca124566
Hi KTNNinja,
Thanks for reporting the error. We're rolling out a fix and this should be fixed within a couple of minutes.
Best,
To learn more visit the Shopify Help Center or the Community Blog.
To update, tested it now and it's working!
Thanks @Poulping and @jbourassa for the help and looking into this!
Hey selina10261,
I don't understand what your question is, please elaborate.
To learn more visit the Shopify Help Center or the Community Blog.
Hey @jbourassa,
To follow up on the fix, I'm running into a case where I have a card on Stripe with a Billing Address where city is misspelled and country is "USA" vs "US" for example. After executing the mutation, I get a Shopify payment method with a Billing Address with the same misspelled city, country: "USA", countryCode: "ZZ" (in this case, not sure if it varies), province: "NY" and provinceCode: None.
Another case where the billing address is spelled correctly and country is "US", I get a Billing Address for the Shopify Payment Method where (to match the above) country: "United States", countryCode: "US", province: "New York", and provinceCode: "NY".
Since Stripe passed these inputs, was wondering if this can be adjusted to catch these or if I would need to address these myself?
Unfortunately, we don't support editing these details on the customer payment method through the API at the moment. One potential workaround is to fix these in Stripe, revoke the previous payment method, and re-import.
To learn more visit the Shopify Help Center or the Community Blog.
@jbourassa Ah I see, would this also explain why when I try to update the card through the link sent from admin's "send link to update card" (card is created from Stripe) and change/update the billing address, an error page pops up as a result after clicking the update/confirm button? It works when updating Shopify test cards
To learn more visit the Shopify Help Center or the Community Blog.
Hey @jbourassa, this is the `x-request-id`: 14eaa2f1-396b-4b1e-957b-654cbb1b2086
And for more context, this is what I see after clicking "update":
To learn more visit the Shopify Help Center or the Community Blog.
@KTNinja this should have been fixed, address can now be updated through the update card flow.
Thanks again for reporting the issue.
To learn more visit the Shopify Help Center or the Community Blog.