Re: Response unexpected_error and No such customer: 'card_xxxxxxxxxxxxxxxx'

Solved

Response unexpected_error and No such customer: 'card_xxxxxxxxxxxxxxxx'

camelmasa
Shopify Partner
83 10 27

We are providing the subscription app on Shopify App Store. 

We called Subscription's BillingAttempt API at 2021-10-06 12:00 (UTC).
Ref: https://shopify.dev/api/admin-graphql/2021-07/mutations/subscriptionBillingAttemptCreate

The response's error_code was "unexpected_error" and error_message was "No such customer: 'card_xxxxxxxxxxxxxxxx'". What is the error?

Also, The customer has a payment method. The payment method is integrated with Stripe by customerPaymentMethodRemoteCreditCardCreate mutation API.
Ref: https://shopify.dev/api/admin-graphql/2021-10/mutations/customerpaymentmethodremotecreditcardcreate

 

Thanks,

Accepted Solution (1)
vladimird
Tourist
8 2 6

This is an accepted solution.

@camelmasa Correct, you need to call Revoke first.

And when you call Revoke, there will be an error that there's active subscription associated with this payment method.

If it's test subscription, you can just cancel it. If it is actual customer's subscription, then you would need something like that:

  1. Pause the subscription.
  2. Revoke payment method.
  3. Create new payment method.
  4. Associate the new payment method with the subscription.
  5. Activate the subscription.

For steps 1,4,5 you will need combination of these mutations:

https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptioncontractupdate
https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptionDraftUpdate
https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptionDraftCommit

 

View solution in original post

Replies 7 (7)

vladimird
Tourist
8 2 6

Observing the very similar problem here: https://community.shopify.com/c/shopify-apis-and-sdks/stripe-payment-method-from-customerpaymentmeth...
So, this is widespread.

Shopify Support, please, address ASAP.

vladimird
Tourist
8 2 6

@camelmasa, we've received a reply from Justin B from Shopify Developer Support:

Just letting you know the issue was identified and a fix was just deployed. The fix has restored the previous behaviour for this mutation by allowing it to be sent with only the StripeCustomerId and customerId arguments. It will also ensure any payment methods created with this mutation moving forward are valid and able to process billing attempts.

So, if you try to re-create the payment method now, it should work. We were using this mutation passing only customerId (Shopify's) and stripeCustomerId, and it was creating correct payment methods.

Good luck!

camelmasa
Shopify Partner
83 10 27

Awesome! Thank you for sharing the information. I'll try that!

camelmasa
Shopify Partner
83 10 27

@vladimird Did you try that ? Did you receive a "has already been taken" error when calling customerPaymentMethodRemoteCreditCardCreate mutation API?

camelmasa
Shopify Partner
83 10 27

Should I call customerPaymentMethodRevoke mutation API first?
https://shopify.dev/api/admin-graphql/2021-10/mutations/customerPaymentMethodRevoke

vladimird
Tourist
8 2 6

This is an accepted solution.

@camelmasa Correct, you need to call Revoke first.

And when you call Revoke, there will be an error that there's active subscription associated with this payment method.

If it's test subscription, you can just cancel it. If it is actual customer's subscription, then you would need something like that:

  1. Pause the subscription.
  2. Revoke payment method.
  3. Create new payment method.
  4. Associate the new payment method with the subscription.
  5. Activate the subscription.

For steps 1,4,5 you will need combination of these mutations:

https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptioncontractupdate
https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptionDraftUpdate
https://shopify.dev/api/admin-graphql/2021-10/mutations/subscriptionDraftCommit

 

camelmasa
Shopify Partner
83 10 27

Oh my gosh! Thank you for your kindness!