There doesn't seem to be a way to test a failed transaction

Topic summary

Merchants testing Shopify Subscriptions report they can’t add invalid cards in Shopify Payments test mode, making it hard to simulate failed charges and retry flows.

Shopify staff acknowledge the limitation: there’s no supported way to make a card that initially succeeds later fail; recommend handling failures via SubscriptionBillingAttempt error codes; no timeline for a fix. Revoking a payment method yields different errors than a card decline.

Workarounds shared (mixed reliability over time):

  • Update via sendCustomerPaymentMethodUpdateEmail to Stripe’s “Decline after attaching” test card (4000 0000 0000 0341) to trigger billingAttemptFailed webhook; later reports said this sometimes no longer works.
  • Temporarily disable test mode, replace with a real card, then re-enable test mode; a billing attempt returns payment_method_incompatible_with_gateway_config and triggers subscription_billing_attempts_failure (risk: real card use).
  • In Stripe test mode, disable the card brand used (e.g., Visa/Mastercard) or replace with a non-accepted brand (e.g., Diners Club). A billing attempt then fails (e.g., “Credit card brand is not accepted,” error_code “unexpected_error”).

Some mutations (get update URL, revoke method) can error. Status: no official solution; thread remains open with community workarounds.

Summarized with AI on January 12. AI used: gpt-5.

I’ve tried @ChrisF2132 's method and can confirm it is no longer working as of now (27 Jan 2023). I am not comfortable with using my own credit card like @devsmk suggested. I finally figured out a way:

  • Check out a subscription product using a Stripe test card, remember what type of card you are using for this checkout, ie. is it a Mastercard or Visa or Amex, etc.
  • Then go onto Stripe Admin → Settings (bottom left) → Payments → disable the type of card you used earlier → Save.
  • Configure a something to listen to the Webhook of type SUBSCRIPTION_BILLING_ATTEMPTS_FAILURE
  • Then trigger a billingAttempt from your app, you should see a Failed billing attempt comes through. I used Google pub/sub, my webhook payload look like below:

{
“id”: 454765668,
“admin_graphql_api_id”: “gid://shopify/SubscriptionBillingAttempt/111823452346”,
“idempotency_key”: “whatever-unique-key”,
“order_id”: null,
“admin_graphql_api_order_id”: null,
“subscription_contract_id”:2353425623,
“admin_graphql_api_subscription_contract_id”: “gid://shopify/SubscriptionContract/2353425623”,
“ready”: true,
“error_message”: “Credit card brand is not accepted for payment”,
“error_code”: “unexpected_error”
}
This is a full list of error codes for a billingAttempt https://shopify.dev/api/admin-graphql/2023-01/enums/subscriptionbillingattempterrorcode , maybe you can simulate more scenarios such as Invalid Address, PAYMENT_METHOD_INCOMPATIBLE_WITH_GATEWAY_CONFIG, etc.

I hope that helps.

1 Like