Webhook works when I simulate a webhook event, but not when I use my app

jhsmith12345
Contributor
Contributor

Hi all, I have a working listener that can successfully log data from a webhook simulation. When I try to use this webhook with my app, I get nothing from my listener server. The app successfully logs all relevant info in the browser console, and executes a payment. I have an API with webhooks enabled, and am using the clientID given in that API. I'll post some code:

Server:

const express = require("express");
app = express();
app.use(express.json());
const bodyParser = require("body-parser");

app.post("/", (req, res, next) => {
 console.log(req.body);
  res.status(200);
res.send("on");
next();
});

app.listen(3000, () => console.log("server started"));

App:

import React from "react";
import PaypalExpressBtn from "react-paypal-express-checkout";

export default class Pay extends React.Component {
  render() {
    const onSuccess = payment => {
      console.log(payment);
    };

    let env = "sandbox"; 
    let currency = "USD"; 
    let total = 3.29; 

    const client = {
      sandbox:
        "ID_FROM_MY_API_WITH_WEBHOOKS_ENABLED",
      production: "YOUR-PRODUCTION-APP-ID"
    };

    return (
      <div>
        <PaypalExpressBtn
          onSuccess={onSuccess}
        />
      </div>
    );
  }
}

Any ideas? It seems like this should all work?!


Login to Me Too
1 REPLY 1

jhsmith12345
Contributor
Contributor

I'm fairly convinced this is a paypal bug, have started a ticket. Am going to bump in hopes that someone sees this.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.