#Xythantiops - CLI trigger overrides
1 messages · Page 1 of 1 (latest)
I think you have to specify --override charge:<some_field_to_override> for each field similar to below:
stripe trigger charge.succeeded --override charge:amount=1998 --override charge:customer="cus__test_customer"
Using the separate overrides works. The second part is can I create a customer record that I can use for triggering events. That way I could trigger a charge and a refund for the same customer with the intent being to send those test events to the webhooks for my application
I am also curious if I could override the payment method or if it makes sense to create different customers using different test credit cards depending on what I am trying to emulate
You could create your own test customer and provide that cus_123 id, sure
Xythantiops - CLI trigger overrides
I have one more question. I created a customer in the Stripe Dashboard. I added one of your test credit cards to the user (e.g. 4242 4242 4242 4242), but when I try to use that customer for a transaction, I get the following error:
Customer cus_N96H37zHXzQ4OC does not have card with ID tok_visa
https://dashboard.stripe.com/test/logs/req_Lch2NnRmaFN1rV?t=167338126
stripe trigger charge.succeeded --override charge:amount=1998 --override charge:customer="cus_N96H37zHXzQ4OC"
Setting up fixture for: charge
Running fixture for: charge
Trigger failed: Request failed, status=404, body={
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "Customer cus_N96H37zHXzQ4OC does not have card with ID tok_visa",
"param": "card",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_Lch2NnRmaFN1rV?t=1673381269",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Is there an extra step that I need to set the ID tok_visa? Is it not available for test transactions or do I need to specify that it is a test transaction?
Ah interesting -- take a look at that request log, and you'll see it supplies source=tok_visa
this works without a customer, but when providing a customer the source must be a valid attached source for that customer
If you set up a card in the dashboard, you can try also override the source used in the trigger
Otherwise you may wish to look at creating your own modified trigger fixture with this parameters
Ok, that does work. Inside of the payment method for the card, there is a field called ID starting with "card_*" that I can include to use that card as the source
Thank you for your help
NP! Glad it helped 🙂