Closed hashimaziz1 closed 2 years ago
👋 @Kaos-Industries , thanks for filing this issue. The reason why you are getting that failure is because the --override / --add / --remove
flags require you provide the name of the fixture as well.
In case you didn't know, stripe trigger
actually uses the stripe fixtures
command under the hood by simply selecting a predefined fixture file (You can find the one for payment_intent.succeeded
here).
Being that the fixture name is payment_intent
, you'd run it like so:
stripe trigger payment_intent.succeeded --add payment_intent:confirm=true
If you want more flexibility on the parameters being set or API calls being made I'd recommend using stripe fixtures
, i.e create a file like so:
// payment_intent.succeeded.json
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_intent",
"path": "/v1/payment_intents",
"method": "post",
"params": {
"amount": 2000,
"confirm": "true",
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method": "pm_card_visa",
"payment_method_types": ["card"],
"shipping": {
"name": "Jenny Rosen",
"address": {
"line1": "510 Townsend St",
"postal_code": "94103",
"city": "San Francisco",
"state": "CA",
"country": "US"
}
}
}
}
]
}
Then to run it:
stripe fixtures payment_intent.succeeded.json
The stripe fixtures
command also supports the --override / --add / --remove
flags as well if you need them.
Showing a runtime error in this case is not a great experience either so we'll go ahead and fix that to be a clearer error message as well 👍
I'm testing Stripe webhooks locally using the Stripe CLI, and so far I've used it to return a PaymentIntent object that contains most of the data I need to capture and have also successfully persisted most of that data to my database, but I'm not able to get the postcode entered by the user in the Payment Element -
billing_details
and any objects under it give me undefined index errors when accessing them like so:$transaction->postcode = $paymentIntent["billing_details"]["address"]["postal_code"];
Looking at the API documentation, it seems this is because billing_details is not available in a normal Payment Intent created by the
create()
method, but it does say:How can I therefore make the Stripe CLI return a Payment Intent that uses the "confirm API" and therefore has access to more of the data about my transaction?
I've tried running both:
...but they both give more or less the same error:
And the same command with debugging enabled:
I'm using the Windows binary on Cygwin, which is an emulated UNIX-like environment running on top of Windows, but the rest of the binary has functioned fine as most .exes are expected to, so I don't think it's an environment issue.