If we are using Shopify Payments in test mode, it doesn't allow you to put in an invalid credit card number from https://help.shopify.com/en/manual/payments/shopify-payments/testing-shopify-payments#simulate-faile.... When you try to checkout, it fails. If you try to update your payment method to one of those, it just says 'Failed to update payment method'. So this means the payment method on a subscription is always valid in test mode, since we can't add non valid ones.
I agree, this is very important to test our failed credit card flows. Would revoking a customer's payment method lead to a failed billing attempt?
There needs to be a way to add an invalid credit card number or to invalidate a credit card using test mode.
Currently there isn't a way to test a card that succeeds initially and then fails for the reasons that you mentioned. The best way right now is to look at the error code that will be returned when a billing attempt fails.
I believe revoking a customer payment method will give you an error code but it won't be the same as if a card was declined, or another error.
Here is a current list of error codes that can be returned: https://shopify.dev/docs/admin-api/graphql/reference/orders/subscriptionbillingattempterrorcode
Hey @matart , I understand we can look at the error code, but the issue is I cannot actually make sure a transaction fails so I can test my flow properly with retries. Is there any plans to allow us to enter invalid card numbers?
I wish I had better news, this issue is on our radar but there currently isn't a timeline for implementing it.
I ended up finding a way to make this work by checking out a subscription with the normal test card, and then using the sendCustomerPaymentMethodUpdateEmail mutation to receive and email to update my card.
I then updated the customer's payment method to Stripe's "Decline after attaching" card:
4000 0000 0000 0341
And then tried to create a billing attempt. It then fired the "billingAttemptFailed" webhook and I was able to test my flow.
I also tried getting the update payment url and revoking the payment method via mutations both threw me respective errors:
Payment method instrument not supported for this mutation
Failed to delete customer payment method due to presence of valid subscription.