Live mode transaction verified, but money was never sent

multiwebinc
New Community Member

I made a React app and used @paypal/react-paypal-js to integrate payments. Everything worked fine in Sandbox mode, and everything appears to work in live mode, however I had a client make a purchase in live mode, and they were successfully given an order ID after submitting payment, however the amount was never debited from their account and was never credited to our account. I contacted PayPal support and they said they had no record of that order ID.

In my app, the payment is made and returns an object like the following: 

 

multiwebinc_0-1651275040644.png

 

The orderID gets sent to the server when the user submits the form and the payment is verified with the PayPal Order API server and the amount is checked against the expected cost of the purchase. Here is the relevant code:

 

const validatePayPalPayment = async (orderId, expectedTotal, reply) => {
  try {
    const accessToken = await getPayPalAccessTokenRequest();
    const orderDetails = await getPayPalOrderDetails(orderId, accessToken);

    if (orderDetails.error) {
      return reply.status(500).send({ error: orderDetails.error });
    }

    if (
      parseFloat(orderDetails.data.purchase_units[0].amount.value) !== expectedTotal
    ) {
      return reply.status(400).send({
        error:
          'The PayPal payment was for an incorrect amount. Please contact us to manually add your reservation.',
      });
    }
  } catch (error) {
    return reply.status(400).send({
      error:
        'We were unable to validate your PayPal payment.',
    });
  }
};

const getPayPalOrderDetails = async (orderId, accessToken) => {
  return await axios({
    method: 'get',
    url: process.env.PAYPAL_ORDER_API + orderId,
    headers: {
      Accept: 'application/json',
      Authorization: `Bearer ${accessToken}`,
    },
  });
};

 

The URLs being used on the server to get the accessToken and validate the payment

PAYPAL_OAUTH_API='https://api-m.paypal.com/v1/oauth2/token/' 
PAYPAL_ORDER_API='https://api-m.paypal.com/v2/checkout/orders/'

 

I have no idea how I can even debug this. I don't know how I can get an order ID that doesn't exist.

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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