Search code examples
phppaypalpaypal-nvp

PayPal NVP Integration - Payment not processed


I am currently working on a new integration with PayPal with the NVP (paypalfunctions.php) to process payments. Same integration works for other projects, but on the current one it fails.

Description: Payment Link gets created successfully - gets redirected to Paypal - Login and pay the amount (1 or 5 EUR) - get redirected to the success url.

Problem: Neither the shop account nor the senders account sees the payment and I dont get any callback from PayPal - thus the payment was not processed/accepted, etc. but I dont get any information from Paypal.

The NVP settings that I use are minimal and dont need a delivery address:

$nvpstr="&PAYMENTREQUEST_0_AMT=". $paymentAmount;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
$nvpstr = $nvpstr . "&NOSHIPPING=1";
$nvpstr = $nvpstr . "&BRANDNAME=MyName";
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CUSTOM=" . $paymentId;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_NOTIFYURL=https://my.callback.com";

The URL gets created successful and all variables are set.

Any idea why this is not working?

Many Thanks

bert2002


Solution

  • It sounds like you're missing the final call in the process. The flow should be:

    1. SetExpressCheckout
    2. GetExpressCheckoutDetails
    3. DoExpressCheckoutPayment

    No money will be moved until the final DECP call is completed successfully.

    Side note: What you're doing is not using the REST API / SDK, so that tag is misleading.

    I have a PayPal PHP SDK that will make these API calls very quick and easy for you, so you won't have to build those out manually like you are now. I would recommend you take a look at it. I think you'll like it.