stripe/stripe-cli

Simulating completed checkout sessions using fixtures no longer works

Closed this issue · 1 comments

It seems that the following "recipe" no longer works.

"""
The CLI supports simulating completed Checkout payment sessions using stripe trigger checkout.session.completed.

If you want to simulate completed mode=setup sessions, you can do so using a custom fixture. Following the example of the flow above, we can exercise the setup flow as follows:

{
  "_meta": {
    "template_version": 0
  },
  "fixtures": [
    {
      "name": "checkout_session",
      "path": "/v1/checkout/sessions",
      "method": "post",
      "params": {
        "success_url": "https://httpbin.org/post",
        "cancel_url": "https://httpbin.org/post",
        "mode": "setup",
        "payment_method_types": [
          "card"
        ]
      }
    },
    {
      "name": "payment_page",
      "path": "/v1/payment_pages/${checkout_session:id}",
      "method": "get"
    },
    {
      "name": "payment_method",
      "path": "/v1/payment_methods",
      "method": "post",
      "params": {
        "type": "card",
        "card": {
          "token": "tok_visa"
        },
        "billing_details": {
          "email": "stripe@example.com"
        }
      }
    },
    {
      "name": "payment_page_confirm",
      "path": "/v1/payment_pages/${checkout_session:id}/confirm",
      "method": "post",
      "params": {
        "payment_method": "${payment_method:id}"
      }
    }
  ]
}

Then run the test using stripe fixtures ~/path/to/checkout-setup.session.completed.json
"""

As previously discussed here #516 (comment)
Originally posted by @brendanm-stripe in #516 (comment)

This has been running fine for around 4 months, but now I'm experiencing a setup_intent.requires_action in my logs blocking the fixture from completing.

Is there any way around this issue? Maybe a fixture that lets me complete the required action (which i believe is 3DS related?)

Thanks for any help!

Turns out this is somewhat of a false alarm!

If you change the params of the payment method fixture to be

{ "card": { "exp_month": 12, "exp_year": 50, "number": "378282246310005", "cvc": "000" } }

Which is a non 3DS required tests card (https://stripe.com/docs/testing#three-ds-cards) it works again!

This is some pretty obscure shit tough, and it would probably be pretty lovely if I could fixture my way around solving the 3DS prompt