#papix_webhooks

1 messages · Page 1 of 1 (latest)

woven flareBOT
junior harnessBOT
#

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.

woven flareBOT
#

👋 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.

sullen arch
#

Hello mate

#

I need 1 example for send data in webhook

tacit mirage
sullen arch
#

and i can send info as argument?

tacit mirage
#

It will generate mock datas. You can also override some attributes

sullen arch
#

i have the webook in stripe panel done

sullen arch
#

it's done, i need only know how i can send data

tacit mirage
sullen arch
#

i needed in php

tacit mirage
#

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.

tacit mirage
sullen arch
#

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

tacit mirage
#

No sorry I don't understand you, can you explain more ?

sullen arch
#

i setup one script in callback.php

#

i add the endpoint in stripe

#

now i want stripe send data as parameter to callback.php

tacit mirage
#

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

woven flareBOT
sullen arch
#

again?...

#

i know how can test stripe trigger...

#

the question it's HOW send DATA to my webhook

shell vault
sullen arch
#

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

woven flareBOT