#PoopFace - Trigger Action

1 messages ยท Page 1 of 1 (latest)

soft badger
#

Hi ๐Ÿ‘‹

worn edge
#

Hello ๐Ÿ˜„

soft badger
#

Can you clarify what you mean? What kind of action are you trying to trigger.

worn edge
#
2022-06-22 00:15:21   --> connect capability.updated [evt_1LDFLwPWwd3EVn8DTL6uvVuF]
2022-06-22 00:15:21  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFLwPWwd3EVn8DTL6uvVuF]
2022-06-22 00:15:58   --> connect person.created [evt_1LDFMYPWwd3EVn8DJ5Wd4qDa]
2022-06-22 00:15:58  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFMYPWwd3EVn8DJ5Wd4qDa]
2022-06-22 00:16:18   --> connect account.updated [evt_1LDFMsPWwd3EVn8DN3Y1QzZT]
2022-06-22 00:16:18  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFMsPWwd3EVn8DN3Y1QzZT]
2022-06-22 00:16:18   --> connect capability.updated [evt_1LDFMsPWwd3EVn8DRxdOY3yi]
2022-06-22 00:16:18  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFMsPWwd3EVn8DRxdOY3yi]
2022-06-22 00:16:25   --> connect account.external_account.created [evt_1LDFMzPWwd3EVn8DQjTqRPgE]
2022-06-22 00:16:25  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFMzPWwd3EVn8DQjTqRPgE]
2022-06-22 00:16:26   --> connect account.updated [evt_1LDFMzPWwd3EVn8DfjYwUn2c]
2022-06-22 00:16:26  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFMzPWwd3EVn8DfjYwUn2c]
2022-06-22 00:16:49   --> connect account.updated [evt_1LDFNNPWwd3EVn8D4bccNrQD]
2022-06-22 00:16:49  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFNNPWwd3EVn8D4bccNrQD]
2022-06-22 00:16:50   --> connect capability.updated [evt_1LDFNNPWwd3EVn8DfqcQah6x]
2022-06-22 00:16:50  <--  [200] POST http://localhost:8080/api/payment/webhook [evt_1LDFNNPWwd3EVn8DfqcQah6x]

I have a webhook that i receive updates on, and I am trying to add the stripe customer account id to the database after the process is done, but using capability.updated can trigger false, as the user can cancel before submit button

soft badger
#

can trigger false
What do you mean by this?

worn edge
#

the webhook triggers update after each step, how can i trigger after the last submit ?

#

if i cancelled now, before submitting, it's still saved to the database, since the action is triggered after the first capability.updated

soft badger
#

Well the accounts capabilities are being updated. What is it you are trying to achieve by waiting for the final submit?

worn edge
#

create the account

#

if i cancelled, it's created but restricted

soft badger
#

How are you onboarding these accounts?

worn edge
#

sorry what do you mean by onboarding ?

soft badger
#

The form you linked is the one used to onboard connect accounts. Often using something like an Account Link

worn edge
#

i am forcing the users on my app to create stripe connect account

#

so that they can receive payments

#

I am adding their account id to the database : acct_1LDFecBBKBGpMxwP

#

indicating they already have account, so they can proceed

soft badger
#

Okay so the Account is created before it has any capabilities. Usually that is the first step.

worn edge
#
            // user creates an account
            // ToDo : check externel_account.create
            case 'account.updated':

                const accountId = event.data.object.id
                const userId = event.data.object.metadata._id

                await paymentService.updateStripeAccount(accountId, userId)

            default:
                console.log(`Unhandled event type : ${event.type}`)

soft badger
#

The account ID won't change when the capabilities update. You have the Account ID when the account is created.

worn edge
soft badger
#

So in your case 'account.updated' event handler you can inspect the event.data.object.requirements. If it's empty then the user has provided everything they need. to.

worn edge
#

thank you, gonna try it out ๐Ÿ˜„

soft badger
#

I hope it works for you ๐Ÿ™‚

worn edge
#

thanks Snufkin, it worked ๐Ÿ˜„

soft badger
#

๐ŸŽ‰

#

Great, I'm glad ๐Ÿ™‚

worn edge
#

sorry quick question : is there any way to print the response in stripe cli ?
I can only see the status code

soft badger
#

What response do you mean? Are you talking about the stripe listen?

worn edge
#

yes, the returned response for the webhook

#

it only shows the status code :
2022-06-22 01:08:27 <-- [200] POST http://localhost:8080/api/payment/webhook [evt_1LDGBKBHQNOY4ZJXsHMRRUqj]

soft badger
#

try adding the --format JSON flag to your stripe listen command

worn edge
#

nice i looked at stripe -h but i found nothing lol

#

thanks again ๐Ÿ˜„