#millennialbets.eth

1 messages ยท Page 1 of 1 (latest)

quaint lavaBOT
magic marlin
#

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

still cove
#

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

magic marlin
#

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

still cove
magic marlin
#

how do i update an existing customers payment?

still cove
#

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.

magic marlin
#

yes

still cove
#

You're referencing a Payment Method that doesn't exist. Try doing that with the pm_card_visa value you were using before.

magic marlin
#

still not working

still cove
#

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.

magic marlin
#

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

still cove
magic marlin
#

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

still cove
#

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?

magic marlin
#

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

still cove
#

Are you trying to create a Subscription Schedule, those are a different type of object than a Subscription?

magic marlin
#

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

still cove
#

Okay, so I don't think you want the subscription_schedule.created event then, I think you're looking for customer.subscription.created

magic marlin
#

great! can i specify the type of subscription?

#

or the name of the subscription

#

for example change my product to datamap

still cove
#

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

still cove
magic marlin
#

it is a product

still cove
#

I think the --override parameter is what you're looking for, but I'm working on testing whether it works for what you want.

magic marlin
#

thank you

still cove
#

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]

magic marlin
#

thank you i'll try this