#Salman
1 messages · Page 1 of 1 (latest)
hello! it can request for the connected account user to fill up their bank account. But what type of Connected account type are you using?
basically we want to ensure user has linked external account to his connect account during onboarding.... does it depend upon capabilities we request during account creation?? if so then which capability do i need to provide to ensure stripe collects user external account information too?
we're using custom type
which country is your platform account in?
in france
you can do that by turning on the setting here : https://dashboard.stripe.com/test/settings/connect/custom
so it doen't depends upon capabilities we just need to turn on the settings from dashboard to ask for external_account information during connect onboarding...am i right?
I believe so, yep. Try it out
I'm testing a webhook with stripe cli but i am unable to receive events on backend
Here is my post api listening to webhooks:
const router = require("express").Router();
let stripeSecretKey = require("../config").stripeSecretKey;
let stripe = require("stripe")(stripeSecretKey);
const endpointSecret = "whsec_ec64d962.......13c7b651110e49115432fd45e4be340";
router.post("/webhook", express.raw({ type: "application/json" }), (request, response) => {
const sig = request.headers["stripe-signature"];
let event;
try {
event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
} catch (err) {
return response.status(400).send(`Webhook Error: ${err.message}`);
}
console.log(event);
// if (event.type === "account.updated") {
if (event.type === "charge.succeeded") {
const account = event.data.object;
handleAccountUpdate(account);
}
response.json({ received: true });
});
const handleAccountUpdate = (account) => {
console.log(JSON.stringify(account));
};
module.exports = router;
Is there a specific error being thrown by your webhook handler?
Are you using stripe listen to listen for and forward the events to your endpoint?
yes
login --> listen --forward-to ---> then trigger
Ok, and is your handler receiving the events?
no it isn't receiving
route is working fine but can't receive/listen any event
Can you share the logs from your stripe listen command?
Can you paste an evt_xxx ID that the CLI has generated?
i can't see any id like that
You'd need to check the Dashboard
And there's no logs from your localhost:8080 application?
yes i can't see any logs too
acct_1Mh7psEMf7jvpGkr
no i've only single account
I can see some charge.succeeded events on that account: https://dashboard.stripe.com/test/events/evt_3Mh8snEMf7jvpGkr0J8g7y8m
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
am i missing something here??
can you check my code?
I don't think your code is the issue here – clearly there's no events even being forwarded to your endpoint
then what the reason will be of events not being forwarded?
Wait. You need to listen before you trigger
Your listen command should always be running, in a separate tab or something
that's something worth to try
In your screenshot you're doing trigger then listen
yeah yeah
yes event is now being forwarded but now i've another one 🥲
No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing
Hi! I'm taking over this thread.
Getting a SignatureVerificationError is quite common. It usually comes from two potential errors:
- You are using the wrong webhook secret. So please double check you are using the correct one. It should look like whsec_xxx and match the one displayed in your dashboard
- The payload you pass in the constructEvent function is not the raw payload. So you need to ensure that you get the raw body of the HTTP request that Stripe sent you, without any interference by your code or framework in the middle.
To debug this you'll need to add logging to log every value you pass to constructEvent (the payload, the secret, and the signature header) and then we can try to have a look at what part is wrong
let me see
I'm receiving this payload:
{
id: 'evt_3Mh9rfEMf7jvpGkr1fz2uHFm',
object: 'event',
api_version: '2022-11-15',
created: 1677754800,
data: {
object: {
id: 'ch_3Mh9rfEMf7jvpGkr1upQiQrs',
object: 'charge',
amount: 100,
amount_captured: 100,
amount_refunded: 0,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: 'txn_3Mh9rfEMf7jvpGkr1x55cuoH',
billing_details: [Object],
calculated_statement_descriptor: 'Stripe',
captured: true,
created: 1677754799,
currency: 'usd',
customer: null,
description: '(created by Stripe CLI)',
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: null,
failure_message: null,
fraud_details: {},
invoice: null,
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: [Object],
paid: true,
payment_intent: null,
payment_method: 'card_1Mh9rfEMf7jvpGkrL9qUewuD',
payment_method_details: [Object],
receipt_email: null,
receipt_number: null,
receipt_url: 'https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTWg3cHNFTWY3anZwR2tyKLCDgqAGMgYQPKTZEJ46LBb7xkl-rbLR7XNsc6lCNIO4dOBMejirmy1mK9XRHb4lvY-hBzNEBiHnhuRw',
refunded: false,
review: null,
shipping: null,
source: [Object],
source_transfer: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'succeeded',
transfer_data: null,
transfer_group: null
}
},
livemode: false,
pending_webhooks: 2,
request: {
id: 'req_cwMaW0ozgvFXv2',
idempotency_key: 'd1c61eda-51df-4090-9e34-9e18a6ba765b'
},
type: 'charge.succeeded'
}
secret key is correct
The payload should be a raw string, not a JSON object.
express.raw({ type: "application/json" })
I'm using this middleware already
I had middleware already in my main file sorry i figured it out lately
now it's working
Awesome!