#kurisu
1 messages · Page 1 of 1 (latest)
Hi there!
Give me a few minutes to look into this.
The webhook endpoint you shared is a Connect endpoint. However the PaymentIntent you shared was directly made on your account (not connect)
So it's expected that you don't see it here.
mhm... our eventhandler respond to the same events successfully when forwarding with stripe CLI. what can we do?
look at that CLI test e.g.
2023-02-22 17:23:33 --> customer.created [evt_1MeL6PKyoozLJBGZmd9jtVBn]
2023-02-22 17:23:33 --> payment_intent.requires_action [evt_3MeL6OKyoozLJBGZ2rD060U7]
2023-02-22 17:23:33 --> payment_intent.created [evt_3MeL6OKyoozLJBGZ2EAMxban]
2023-02-22 17:23:34 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6PKyoozLJBGZmd9jtVBn]
2023-02-22 17:23:34 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_3MeL6OKyoozLJBGZ2EAMxban]
2023-02-22 17:23:34 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_3MeL6OKyoozLJBGZ2rD060U7]
2023-02-22 17:23:39 --> payment_intent.succeeded [evt_3MeL6OKyoozLJBGZ2fCXP2mH]
2023-02-22 17:23:39 --> checkout.session.completed [evt_1MeL6VKyoozLJBGZxFeQ4AW0]
2023-02-22 17:23:39 --> charge.succeeded [evt_3MeL6OKyoozLJBGZ2LVAb7V9]
👋 taking over for my colleague. Let me catch up.
2023-02-22 17:23:40 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6VKyoozLJBGZxFeQ4AW0]
2023-02-22 17:23:40 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_3MeL6OKyoozLJBGZ2LVAb7V9]
2023-02-22 17:23:41 --> transfer.created [evt_1MeL6XKyoozLJBGZYjuDHHZB]
2023-02-22 17:23:41 --> connect payment.created [evt_1MeL6X4KqOcqQ7DzQLQtazP3]
2023-02-22 17:23:41 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_3MeL6OKyoozLJBGZ2fCXP2mH]
2023-02-22 17:23:41 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6X4KqOcqQ7DzQLQtazP3]
2023-02-22 17:23:42 --> connect balance.available [evt_1MeL6Y4KqOcqQ7DzJxiJ6OUC]
2023-02-22 17:23:42 --> customer.updated [evt_1MeL6YKyoozLJBGZw8LYjxKk]
2023-02-22 17:23:42 --> invoice.created [evt_1MeL6YKyoozLJBGZfIQWe0Dl]
2023-02-22 17:23:42 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6Y4KqOcqQ7DzJxiJ6OUC]
2023-02-22 17:23:43 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6YKyoozLJBGZfIQWe0Dl]
2023-02-22 17:23:43 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6YKyoozLJBGZw8LYjxKk]
2023-02-22 17:23:43 --> invoice.updated [evt_1MeL6ZKyoozLJBGZoSWYP8r4]
2023-02-22 17:23:43 --> invoiceitem.created [evt_1MeL6ZKyoozLJBGZMt0MzSCZ]
2023-02-22 17:23:43 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6ZKyoozLJBGZoSWYP8r4]
2023-02-22 17:23:43 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6ZKyoozLJBGZMt0MzSCZ]
2023-02-22 17:23:44 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6XKyoozLJBGZYjuDHHZB]
2023-02-22 17:23:44 --> payment_intent.created [evt_3MeL6aKyoozLJBGZ1XhsGlDn]
2023-02-22 17:23:44 --> invoice.updated [evt_1MeL6aKyoozLJBGZSjI09bpb]
2023-02-22 17:23:44 --> invoice.finalized [evt_1MeL6aKyoozLJBGZN7wj3ToU]
2023-02-22 17:23:45 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_3MeL6aKyoozLJBGZ1XhsGlDn]
2023-02-22 17:23:45 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6aKyoozLJBGZSjI09bpb]
2023-02-22 17:23:45 <-- [200] POST https://localhost:6001/api/webhooks/index [evt_1MeL6aKyoozLJBGZN7wj3ToU]
thx @summer valley
give me a minute to catch up and will be with you shortly
as my colleague explained, we have 2 types of webhooks:
- one for your own events
- another for the connected accounts events
in your case you just need to create a new one which listens to the events on your own account
that seams very strange since the same scenario already worked as you can see below:
christian.sommer@wienerzeitung.at's payment for an invoice for €57.60 succeeded
evt_1Ma11CKyoozLJBGZywAnzLLI
2/10/23, 7:08:17 PM
christian.sommer@wienerzeitung.at's invoice for €57.60 was paid
evt_1Ma11CKyoozLJBGZ3cYbkK1i
2/10/23, 7:08:17 PM
christian.sommer@wienerzeitung.at's invoice for €57.60 was sent
evt_1Ma11CKyoozLJBGZXZeinPb0
2/10/23, 7:08:17 PM
A draft invoice for €57.60 to christian.sommer@wienerzeitung.at was finalized
evt_1Ma11CKyoozLJBGZ14FHHUpK
2/10/23, 7:08:17 PM
A draft invoice was created
evt_1Ma11BKyoozLJBGZDuo1KYqg
2/10/23, 7:08:17 PM
christian.sommer@wienerzeitung.at was charged €57.60
evt_3Ma112KyoozLJBGZ0r5Gd5z3
2/10/23, 7:08:16 PM
The payment pi_3Ma112KyoozLJBGZ0v0RWEZp for €57.60 has succeeded
evt_3Ma112KyoozLJBGZ0MZSJU2l
2/10/23, 7:08:16 PM
Previous
Next
above output comes from the event history on that webhook: https://dashboard.stripe.com/test/events?ending_before=evt_3Ma112KyoozLJBGZ0w9eMS8T
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it depends on whether you created the object on your account or on a connect account
above output uses both accounts.
the connected account is an express one which we use for separate transfers and invoices
let me check that but please give me a couple of minutes and will be right back
as you can see here(https://dashboard.stripe.com/test/logs/req_dTqDcwdIVBwFuY) the event you shared is basically a checkout session you created on your connected account
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
all the objects/events that are generated from that session are linked to the connected account
oh now I see the problem! 😦 my bad it took me a while to see the main issue
you have webhook endpoints on your own account but all of them are disabled
ah, so i have to activate two webhook endpoints. - both on the same URI on our site?
this is the webhook endpoint https://dashboard.stripe.com/test/webhooks/we_1MTNy4KyoozLJBGZDyXoTyUr that has the same URL
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
but it is disabled
normally we don't recommend using the same URL for own account and connect account webhooks
the reason is that the webhook endpoint secret might change and the Stripe instance that you want to create doesn't need the extra Stripe-Account header to fetch the connect account objects
ok, thank you for your explanation. i'll test it. can i respond on this chat if there is still a problem? because i still don't have a satisfying mental model for what you explained.
what do you mean with "the stripe instance" we create?
https://stripe.com/docs/api/authentication global API key
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, i think i understand:
- to post to api endpoints and reseive webhook events on the platform account i use that endpoint and signing secret for event verification.
- to post to api endpoints and reseive webhook events on the connected account i use that endpoint and signing secret for that webhook.
so for the separate charge and transfer scenario we aim at, the API integration and event notification flow has to look as follows:
(1) create checkout session, payment intends, ... and respond to corresponding events on the plattform account side
(2) watch out for charge/checkout succeded events on the plattform side and create a transfer to the connected account (part of the purchase belongs to the connected account)
(3) wait for transfer succeded events on the "connected" webhook side to initiate invoice creation on the plattform side
(4) look for invoice finalized events on the "platform" webhook side to set the invoice as paid and initiate invoice mail delivery.
right?
the first part of your message is true
I'm having some trouble understanding the steps though
our customers pay within one single stripe checkout session for cartitems from us (the platform side) and for items "from one else" (the connected account).
only the purchased connected account items have to
(1) show up on the invoice and
(2) the amount payed for them must be transfered to the connected account.
we'ld prefer invoicing also to happen on the connected account side if that's possible. - currently invoicing happens on the platform side.
you can choose to create a destination charge and get your share of the payment via application_fee_amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so the destination charge would have included the sum of the items sold from the platform side.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-application_fee_percent
if you're dealing with subscriptions
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes the whole amount
i think i understand. so destination charges seams to be an easier to implement, "straight forward" way to solve our problem - but the prefiously outlined way above for separate charges and transfers would also be a viable solution, wouldn't it?
but you would have to create the invoices on your own
yes manualy via api calls.
so i understand invoice creation with destination charges is "possible". can we invoke a checkout session for destination charges and also tell the api to create and send invoices?
this would indeed be a very downstriped way to get to our goal.
Hi! I'm taking over this thread.
can we invoke a checkout session for destination charges and also tell the api to create and send invoices?
Yes this is possible:
- For Destination Charge use https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_data
- For invoice creation use https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-invoice_creation
hi @dawn kayak
thx @summer valley
ok i can try that.
but still the cart items for products from both sides (platform soled and connected account soled) must be listed on the checkout session and only the lineitems for products from the connected account must be on the invoice.
With my suggestions above, the invoice will contain exactly the same item as in the Checkout Session. If that's not what you want, then you'll need to generate the invoice yourself.
ok, i see. so the way i outlined above must be followed, resulting in API and webook integration on the platform as well as the connected account side. right?
Can you summarize this in a new message? The thread is quite long to follow.
shure:
(1) create checkout session, payment intends, ... and respond to corresponding events on the plattform account side
(2) watch out for charge/checkout succeded events on the plattform side and create a transfer to the connected account (part of the purchase belongs to the connected account)
(3) wait for transfer succeded events on the "connected" webhook side to initiate invoice creation on the plattform side
(4) look for invoice finalized events on the "platform" webhook side to set the invoice as paid and initiate invoice mail delivery.
(1) create checkout session, payment intends,
If you create a Checkout Session, the PaymentIntent will be automatically created for you
and create a transfer to the connected account
If you use Destination Charges the transfer is done automatically for you
yes, but using destination charges would result in invoice with lineitems for products we sell from the platform account as well as the connected account side which we do not want.
so we have to use "separate charges and transfers", don't we?
If I understand correctly, you want the end customer to pay once for products that belong to both the platform and the connected account? And then you want to create one invoice only for the items that belong to the connected account?
yes. exactly.
our ERP already creates invoices for products from our (platform) side and we can't do that invoicing within stripe.
And how do you want to collect the payment? Checkout Session?
And there will be a single Connected account involved in the transaction? Or can there be multiple?
currently only one. we need it because there must be a separate bank account behind.
Then Checkout Session with Destination Charges should work. And then it's up to you to manually create an invoice for the connected account (and mark it paid out of bounds).
ok i understand. but that would me only release of transfering the amout for the connected account products to that account on my own.
If you want to manually send the amount to the connected account, then yes use Separate Charges & Transfers.
what other problems would the destination charges way solve?
would it also solve the problem of insufficient funds errors. since the platform account shouldn't run out of funds.
what other problems would the destination charges way solve?
It's just simpler to use, since you don't have to do the transfer yourself.
would it also solve the problem of insufficient funds errors.
What do you mean exactly?
currently after initiating the transfer of the connected account part of the paid event (after checkout/charge succeeded event), we get back the insufficient funds error, so the transfer is stopped.
the transfer only works when a collegue of mine (tops up/) pays with a special crafted creadit card on the test environment: 4000 0000 0000 0077
When you create the Transfer you should set source_transaction to avoid this: https://stripe.com/docs/api/transfers/create#create_transfer-source_transaction
yes i already tried that too. but i wasn't able to set the correct source. how can i get that ID?
the source is the Charge ID. If you have a Checkout Session, it should contain a PaymentIntent which contains the Charge object.
@dawn kayak - many, many thx to you and your collegue. i'll try that first with the separate charge and transfer way. 💜