#papix_webhooks
1 messages · Page 1 of 1 (latest)
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.
- papix_checkout-sessions, 12 minutes ago, 78 messages
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1247498148281057292
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
You can use Stripe CLI in order to genreate webhook events:
https://stripe.com/docs/cli/trigger
and i can send info as argument?
It will generate mock datas. You can also override some attributes
i have the webook in stripe panel done
it's done, i need only know how i can send data
You can trigger Stripe to send mock data following the guide I shared
i needed in php
No you can't trigger a webhook event via your own code unless you make an action that triggers a webhook events (e.g. create a Subscription which will triggers a customer.subscription.created event). Webhook events are generated by Stripe infrastrcuture and sent to your webhook endpoint.
You want the code to generate an event or to consume a webhook event sent by Stripe ?
I'll explain it better, I have “website.com/callback.php” I want the stripe to trigger when 1 payment is successful and to send the email field for example to the callback
No sorry I don't understand you, can you explain more ?
i setup one script in callback.php
i add the endpoint in stripe
now i want stripe send data as parameter to callback.php
now i want stripe send data as parameter to callback.php
You need to use Stripe CLI in order to trigger events and make Stripe send events with data to your callback
again?...
i know how can test stripe trigger...
the question it's HOW send DATA to my webhook
Well if you're developing locally you'd use the CLI to listen and forward events received to your dev endpoint: https://docs.stripe.com/cli/listen
i need something like this:
require("dotenv").config();
require("stripe")(process.env.STRIPE_SECRET_KEY);
const { default: axios } = require("axios");
const express = require("express");
const app = express();
const webhookUrl = process.env.WEBHOOK_URL;
const port = process.env.PORT;
const sendToDiscord = (message) => {
const discordPayload = {
content: message,
};
axios.post(webhookUrl, discordPayload);
};
app.post(
"/stripe",
express.json({ type: "application/json" }),
(request, response) => {
const event = request.body;
switch (event.type) {
case "checkout.session.completed":
const paymentCompleteEvent = event.data.object;
console.log(paymentCompleteEvent);
sendToDiscord(
`<@&897216878672478229> Ny betaling fra \`${paymentCompleteEvent.customer_details.email}\``
);
break;
default:
console.log(`Unhandled event type ${event.type}.`);
}
response.send();
}
);
app.listen(port, () => console.log(`Running on port ${port}`));
but in php