#millennialbets.eth
1 messages ยท Page 1 of 1 (latest)
hi thank you for adding me
i am just trying to get a simple cli command to create test some subscriptions being created that can then talk to my webhook
Hi ๐ are you trying to chain those two commands together? I see the second one creating a Subscription references a specific Customer object by its ID, and that Customer currently doesn't have a Payment Method attached.
Did you try using this command to attach a Payment Method to a Customer?
https://stripe.com/docs/api/payment_methods/attach?lang=cli
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
stripe subscriptions create --customer cus_NORWUwdGocZsLw -d "items[0][plan]=price_1MSOuPJHoLTwHJB3f1BOMY65"
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "This customer has no attached payment source or default payment method. Please consider adding a default payment method. For more information, visit https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_wa0bBP0JNRCikj?t=1676990620",
"type": "invalid_request_error"
}
Is what i am trying to fix
i've tried various ways to get add a default payment method, none of them work
stripe customers create --email cli+test@example.com --payment-method pm_card_visa --description "Test customer" --default-payment-method pm_card_visa
This creates a new Customer, it won't update the one you're referencing in your other command.
how do i update an existing customers payment?
Did you try the command shared in the docs that I linked to? It's an endpoint specifically for attaching a Payment Method to a Customer.
You're referencing a Payment Method that doesn't exist. Try doing that with the pm_card_visa value you were using before.
hm
Do you have an actual test flow to add a Payment Method to a Customer? It may be easier if you set up a Customer outside of the CLI and then use it to reference them.
Alternatively you can try creating a new Payment Method first, maybe the CLI doesn't like those test values.
all i want to do is run a test subscription to test my webhook
what is the easiest way to do that
i don't understand how it doesn't like the test values on a test set up
What type of Event are you trying to trigger? Have you tried using stripe trigger which is designed for triggering events for webhook testing?
https://stripe.com/docs/cli/trigger
i just want to trigger a new subscription
with my specific subscription id
price_1MSOuPJHoLTwHJB3f1BOMY65
or datamap
which ever way stripe can link to the sub
Sorry, that doesn't make much sense. Your webhook endpoint shouldn't be expecting a specific Subscription ID because each Subscription will have a unique one generated when it is created.
Alright, let's take a step back, because I'm now a bit confused. What is the flow you're building trying to accomplish?
stripe trigger subscription_schedule.created
that worked, it just needs to be the datamap
I want stripe to talk to my api after there's a successful subscription
Are you trying to create a Subscription Schedule, those are a different type of object than a Subscription?
so i can upload the data to my database
i'm just trying to verify that someone has created a subscription
and then stripe will send a notification to my api so i can update the database
Okay, so I don't think you want the subscription_schedule.created event then, I think you're looking for customer.subscription.created
great! can i specify the type of subscription?
or the name of the subscription
for example change my product to datamap
Sorry, I'm going to get a bit nit-picky with terminology, because it's important to ensure we're talking about the same thing. Subscriptions don't have type or name attributes, you can see a full list of the values associated with a Subscription object here:
https://stripe.com/docs/api/subscriptions/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you elaborate here, is "datamap" a specific Price or Product object in your account?
it is a product
I think the --override parameter is what you're looking for, but I'm working on testing whether it works for what you want.
thank you
You'll want to use this command, replacing the last part with the ID of the Price object you want to use:
stripe trigger customer.subscription.created --override subscription:items[0].price=[PRICE_ID]
thank you i'll try this