#tiago_connect-webhooks

1 messages ยท Page 1 of 1 (latest)

lucid archBOT
#

๐Ÿ‘‹ 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.

low pine
#

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?

feral dirge
#

No the code is not correct. A Connect platform can not create a WebhookEndpoint on a connected account. This is forbidden/always has been

#

tiago_connect-webhooks

low pine
#

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);

feral dirge
low pine
#

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?

feral dirge
#

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

low pine
#

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?

feral dirge
#

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

low pine
#

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?

feral dirge
#

yes

low pine
#

Ok...

#

Thanks