#ahjaydog-webhook-paused-payments
1 messages · Page 1 of 1 (latest)
Hi there! What do you mean by paused payments, exactly?
Like when your account is disabled?
pause payment collection under subscriptions
Thanks
there are trials too where in the past they were used for pauses
Yes customer.subscription.updated is what you want.
ok and then what do i look for to indicate pause?
This event works for both trials and pauses?
For pauses you look at the pause_collection hash: https://stripe.com/docs/api/subscriptions/object#subscription_object-pause_collection. For trials, you look at the status of the Sub which will be trialing
Then there is Pause payment collection for all existing subscriptions under dashboard.stripe.com/settings/billing/automatic
Sure, that will set all Subs to be paused.
ok so when i pause i look for if the hash is not none. Then when the pause hash is none then reactivate membership for example?
Yep, and you may want to check the status as well when it unpauses if you only want to provision when the Sub has a certain status
But that part is up to you.
Once pause_collection is null, then you will know it is unpaused.
what status do you recommend?
Depends... most folks use active but you can also still provision when the Sub is past_due if you still expect future payment for the unpaid invoice depending on your product.
That part is really up to you
ok
another webhook event i am looking for is when i make a subscription for the first time would it be customer.subscription.created ?
Yep. If you haven't taken a look at https://stripe.com/docs/billing/subscriptions/webhooks#events that lays out info on a bunch of the relevant events you'll want.
ok thanks
if i have missing ids or something do you recommend using try except statements or something else?
Yep. We talk about error handling here: https://stripe.com/docs/error-handling. Generally wrapping things in try catch is recommended.
thanks
is there a way to test disputes with ACH/
I also noticed a lot of the docs now for python use json / jsonify why is that?
You can see our test bank account numbers here: https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=checkout#test-account-numbers
The debitNotAuthorized account number is for testing disputes
I'm not a python dev so I can't really speak to exactly why that method is recommended.
ok no worries about the python thing
thank you i'll try that for the ach
what were to happen if lets say i pause everybody and i have a webhook for that, would that be problematic if everybody gets paused at the same time?
If i were to change my database during 'checkout.session.completed to a paid membership would there be a conflict if i do the same thing of customer.subscription.created? They are 2 separate events even though they both make a subscription?
If i were to change my database during 'checkout.session.completed to a paid membership would there be a conflict if i do the same thing of customer.subscription.created?
When you say "do the same thing" do you mean also update the database on thecustomer.subscription.created? If so, what's the point? What are you updating?
when completing the checkout, behind the scenes a subscription gets created
but if i make another separate customer.subscription.created event, will they conflict?
I am updating my database for when someone pays via checkout or if someone on stripe manually adds a subscription, then also update my db
The events you mentioned are entirely separate from each other. No matter where the subscription is created (e.g. Checkout or elsewhere), it will send the customer.subscription.created event. What specifically are you updating in the DB?
if the customer is paid or free
If both events are referencing the same Subscription and Customer, then you shouldn't need to worry about one overwriting the other, because they should both reference the same objects (unless you change something on them between events)
ok i'll give it a try and see what happens
"pause_collection": {
"behavior": "keep_as_draft",
"resumes_at": null
},
That is what happens when i pause a subscription. What exactly do I use here in my if statement?
event.data.object.pause_collection.behavior == keep_as_draft ?
event.data.object.pause_collection != None ?
This is for the event.type == 'customer.subscription.updated':
nevermind i see it is null/None
if i unpause
Alright. Is there an outstanding question here? Or did you unblock yourself?
no i should be ok now sorry
It's all good! I just want to make sure that I'm not overlooking anything and that you're set 😄
"latest_invoice": "in_1LDXIQIeTJrsS1reCATgv4hf" from the subscription.updated event... is that referring to what may have already been paid?
API says The most recent invoice this subscription has generated.
so the one at the top of the invoices section of the customer page
It will be the most recent Invoice that was created. It might be paid, or unpaid.
ok thanks
i think bismark may have given the wrong info before?
whenever i pause i see pause_collection has data and whenever i unpause i see pause_collection None
oh wait sorry
i keep talking to myself today he was right he said not none
How come event.data.object.items.data[0].price.id is not working on customer.subscription.updated
AttributeError: 'builtin_function_or_method' object has no attribute 'data'
This works though - event.data.object.plan.id. In the past the line above has worked for me
That is actually a quirk of Python itself
Can you try the same thing but use event.data.object['items'].data[0].price.id instead?
Essentially python is mixing up the items field with the items() function of the object. I know the one workaround of what I just sent, I forget if there is another way to specify what you are looking for here
Great to hear!