Paypal IPN Not Getting Called In Sandbox
SilentJohn
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Oct-24-2019
07:27 AM
I can create and execute a payment. I can use the IPN Simulator to simulate an Express Checkout and it works. I cannot connect the 2. I assume it is something I am doing or not doing in the execute payment code. Here is the code:
<?php
require "vendor/autoload.php";
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
use PayPal\Api\Transaction;
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'(*ClientID*)',
'(*ClientSecret*)'
)
);
$paymentId = $_GET['paymentId'];
$payment = Payment::get($paymentId, $apiContext);
$execution = new PaymentExecution();
$execution->setPayerId($_GET['PayerID']);
$transaction = new Transaction();
$amount = new Amount();
$details = new Details();
$details->setShipping(0)
->setTax(0)
->setSubtotal(10);
$amount->setCurrency('USD');
$amount->setTotal(10);
$amount->setDetails($details);
$transaction->setAmount($amount);
$execution->addTransaction($transaction);
try {
$result = $payment->execute($execution, $apiContext);
return $result;
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
// This will print the detailed information on the exception.
//REALLY HELPFUL FOR DEBUGGING
echo $ex->getData();
}
?>
I have gone over everything many times. All the default settings and such are right. I have run out of things to try.
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.
Related Content
- Authorization error occurred on Payouts in REST APIs
- Sandbox frozen in Sandbox Environment
- The error when trying to get billing agreement token for not US locations in Sandbox Environment
- Connect To PayPal script failed to show the button on recent websites built. in PayPal Payments Standard
- Buy Now button and variables return / Retour avec bouton "buy now" in PayPal Payments Standard