#RandomAccordian

1 messages · Page 1 of 1 (latest)

timid barnBOT
flat pollen
#

What fields are you looking to add/override?

vital holly
#

The reason for cancellation

flat pollen
#

It's not really an array, the [] just indicate that it's a parameter

vital holly
#

It literally says --add stringArray in the help when you type stripe trigger with no params.

#

But what's the syntax?

#

...for the values used with the --add and --override parameters?

flat pollen
vital holly
#

Great, thanks! It would be cool if the cli displayed a link to the relevant docs too, they were hard to find as there are so many docs

#

Oh oh:

Running fixture for: payment_intent
Trigger failed: Request failed, status=400, body={
  "error": {
    "code": "parameter_unknown",
    "doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
    "message": "Received unknown parameter: cancellation_reason",
    "param": "cancellation_reason",
    "type": "invalid_request_error"
  }
}```
flat pollen
#

What's happening I guess is the CLI is attempting to pass cancellation_reason during the creation request

#

And in that case its an unknown param

vital holly
#

okay, I could tell it to not create the pi

flat pollen
vital holly
#

Are you suggesting I use a fixture to create the pi, then trigger a cancellation for that specific pi?

#

as opposed to triggering a cancellation but skipping the create pi step

flat pollen
#

You can just create a fixture file which does both creation and cancellation, and in the fixture file explicitly pass cancellation_reason param during the cancelation request

#

Then you can skip --override flag which will prevent the issue you just had

flat pollen
vital holly
#

Oh I see, I would provide a fixture for creating the PI, but no fixture is needed for cancelling it 👍

flat pollen
#

No, your fixture would need both

#

Interestingly payment_intent.canceled triggers sets that field anyway 🤔

#

Is that not what you need?

#

Like. if you just do stripe trigger payment_intent.canceled the cancellation_reason should be set on the related event

vital holly
#

Aha this works! --override payment_intent.cancelled:cancellation_reason=requested_by_customer
I had --override payment_intent:cancellation_reason=requested_by_customer
before.

Thank you!!

flat pollen
#

Oh, that's interesting. Didn't know you could pass the event type as the resource param

flat pollen
# vital holly Aha this works! `--override payment_intent.cancelled:cancellation_reason=request...

🤔 Although I suspect that's not actually working and its just defaulting to the fixture which has cancellation_reason: 'requested_by_customer' already: https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/payment_intent.canceled.json#L21

GitHub

A command-line tool for Stripe. Contribute to stripe/stripe-cli development by creating an account on GitHub.

#

Try a different value: --override payment_intent.cancelled:cancellation_reason=duplicate

#

Yeah --override payment_intent.cancelled:cancellation_reason that doesn't work like you expect

#

I tried:
stripe trigger payment_intent.canceled --override payment_intent.canceled:cancellation_reason=duplicate

The event payload:

{
  "object": {
    "id": "pi_3LpVxOLostC5RfZm136ILLMu",
    "object": "payment_intent",
    "amount": 2000,
    "amount_capturable": 0,
    "amount_details": {
      "tip": {
      }
    },
    "amount_received": 0,
    "application": null,
    "application_fee_amount": null,
    "automatic_payment_methods": null,
    "canceled_at": 1664970010,
    "cancellation_reason": "requested_by_customer",
  }
}
#

It's just defaulting to what's in the payment_intent.canceled fixture

#

Another option would be :

stripe payment_intents cancel pi_xxx -d "cancellation_reason=duplicate"
#

Which works (just tested)