#TuanPham
1 messages · Page 1 of 1 (latest)
Hi, I think you might have been missing some steps
one moment
In your Platform, your PaymentMethod should be attached to a customer first
then you want to clone both the Payment Method and the Customer to the Connected Account
yup, I'm trying to do that way
But when I try to attach my PlatformPaymentMethod to my platformCustomer
It says that no such customer even when I checked in the dashboard still have a customer with that id on the platform account
When attaching do you not use the stripe-account header?
If you use stripe account header the API will look into the connected account
I use via stripe instance like this
await this.stripe.paymentMethods.attach(paymentMethodId, {
customer: platformCustomer.stripe_customer_id,
});
Let's confirm it by looking at your Platform requests log
Can you get me that request id? req_xxx
You mean the request id when I attach my platformPaymentMethod to my platformCustomer right?
yes
just a minute
hmm
I'm sorry. It's my lunch time here
Can I reply you in the afternoon ?
Sure np
@peak axle Seeing you were typing. Any follow up?
Hi @winged comet , sorry for the delay. Somehow, I managed to fix my problems. But It comes into new one. I can not catch the event customer.subscription.created in my hook service . When I create a subscription, I can catch the event charge.succeeded only. Can you help me with this ?
do you have the ID sub_xxx of the subscription you created so I can check some details?
so you create this subscription on a connected account using the Stripe-Account header
that means to listen to the event, you need to create a "Connect endpoint" on your platform account
https://stripe.com/docs/connect/webhooks#connect-webhooks are the docs on how that's done
you do seem to have such an endpoint though, so let me check something
yup. take your time
as far as we can tell we sent you that event just fine
it's evt_1LFvrp2ELzgUanaaMGRPWp11, we sent it to your URL https://staging-api-*******/v1/hooks/connect at 2022-06-29 08:03:21 UTC and you responded with a 201 status with {"received":true}
is it related to my stripe config ?
somehow, I still catch the event charge.succeeded
So I think it seems like not the problem from your server
your configuration on our end seems fine, we sent you that event as expected
It seems like my webhook type Direct not works because I do not forward it to my local listeners
hmm, ok!
But, If I forward by this command : stripe listen --forward-to localhost:8082/v1/hooks/connect.
It is supposed to forward both Direct or Connect type to my local host, right ?
not sure, I think maybe not? you might have to use --forward-to and --forward-connect-to together
what does "does not work" mean exactly?
what command did you run, what did you expect to see, what did you see instead?
hmm, I run stripe listen --forward-connect-to localhost:8082/v1/hooks/connect
I expected to catch event customer.subscription.created
I saw it said that [ERROR] Failed to POST: Post "http://localhost:8082/v1/hooks/connect": dial tcp [::1]:8082: connectex: No connection could be made because the target machine actively refused it
👋 I'm stepping in for my colleague
yup
We just try to find a way to forward stripe hooks which has type Direct into my local host
basically when this error happens this means that the tcp port 8082 is not running on your machine
hmm, but I already forwarded it by adb reverse tcp:8082 tcp:8082 in my app
I think I should deploy it and try the payment one more time
how are you running your server
I just run it in local
and my app connects via the localhost, then I use the stripe cli to forward the stripe hook into my localhost
what language are you using for your server?
I use typescript with nestjs
I just checked the dashboard and I see that there is customer.subscription.created in my webhooks which has endpoint type Connect
But I don't know why it can listen to charge.succeeded event only. I did not specify only listen to this event in my stripe cli command
stripe cli will listen to all the events and is not related to the configuration you would do on a specific endpoint
could you please share the logs of your server when you run npm start on your nestjs server locally
okay, let me get it
I'm sorry
It is my fault.
Because there are many events sending to my local host
so it can not hold all the logs
after I just comment all events and open just customer.subscription.created, I got the data I need
no worries, great to hear it's working now