#tiago_connect-webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293965747701284916
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- tiago-rodrigues_api, 1 day ago, 25 messages
- tiago-rodrigues_api, 2 days ago, 28 messages
- tiago-rodrigues_api, 6 days ago, 12 messages
I'm trying to create a webhook using Stripe Connect, below I leave the Code I developed, basically after coming back from the stripe authorization panel you get the access token and then with that access token it is used to create the webhook. Is the code correct? What am I doing wrong?
No the code is not correct. A Connect platform can not create a WebhookEndpoint on a connected account. This is forbidden/always has been
You need to create the WebhookEndpoint on your own account with the type Connect. See: https://docs.stripe.com/connect/webhooks
tiago_connect-webhooks
Can you help me?
how should it look?
StripeConfiguration.ApiKey = accessToken;
var options = new WebhookEndpointCreateOptions
{
Url = "https://higidev.on4web.com/SIBS/StripeHook",
EnabledEvents = new List<string>
{
"customer.subscription.created",
"customer.subscription.deleted",
"customer.subscription.paused",
"customer.subscription.resumed",
"customer.subscription.updated",
}
};
var service = new WebhookEndpointService();
WebhookEndpoint webhookEndpoint = service.Create(options);
You can't use the access token. You have to use your own API key and do this on your own server
And you need to pass the connect parameter: https://docs.stripe.com/api/webhook_endpoints/create#create_webhook_endpoint-connect
try
{
var defaults = new SIBSPaymentDefaults();
StripeConfiguration.ApiKey = defaults.StripeApiKey;
var options = new WebhookEndpointCreateOptions
{
Url = "https://higidev.on4web.com/SIBS/StripeHook",
EnabledEvents = new List<string>
{
"customer.subscription.created",
"customer.subscription.deleted",
"customer.subscription.paused",
"customer.subscription.resumed",
"customer.subscription.updated",
},
Connect = true
};
var service = new WebhookEndpointService();
WebhookEndpoint webhookEndpoint = service.Create(options);
Console.WriteLine($"Webhook criado com sucesso: {webhookEndpoint.Id}, {webhookEndpoint.Secret}");
}
catch (StripeException stripeEx)
{
Console.WriteLine($"Erro ao criar o webhook - StripeException: {stripeEx.StripeError.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"Erro ao criar o webhook: {ex.Message}");
}
Is it like this?
How does weebhook then become connected to the client?
yes it's like that. Did you read the doc I linked already end to end? If not, please do, it explains this in details
Each Event will have the account property set to the connected account id acct_12345 that the Event comes from. So that you as a platform can look at that and reconcile the information as needed
I'm doing this because I'm developing an extension for nopcommerce, and the goal is to be able to automatically configure the webhook and then be able to receive them without having to go to my account to see what the secret key of the webhook is and pass it on to the customer, I wanted it to be an automated process.
Can i do that?
No that is impossible with Webhooks. You are a Connect platform, you will receive all those Events and you'll have to forward those to each plugin install for example
What are you saying is that in order to do what I want, I have to have an intermediary to be able to receive all the webhooks and then send them to the respective client?
yes