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
- PAYER_ACTION_REQUIRED returned for Capture intent when calling v2 checkout orders in Sandbox Environment
- API TRANSACTION_REFUSED in Sandbox when Capturing Payment in REST APIs
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard
- Enable Billing Address Feature in Sandbox Environment
- How do you dynamically pass an item name through an 'add to cart' button? in Sandbox Environment