php - Getting Order details from Paypal API
Get the solution ↓↓↓I am new to Paypal Smart Buttons.
I have been able to successfully make a purchase and when returning to my site , I am able to get ID for the order.
I am wanting to verify the transactionID is a legitimate ID for the next step.
To do this, I am trying to use the PHP SDK
I have created the following code
require 'vendor/autoload.php';
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'sandboxclient',
'sandboxsecret'
)
);
$payment = new \PayPal\Api\Order();
try {
$payment->get("8T0564921E866114V",$apiContext);
echo $payment;
}
catch (\PayPal\Exception\PayPalConnectionException $ex) {
echo $ex->getData();
}
However I receive an error:
{"name":"INVALID_RESOURCE_ID","message":"The requested resource ID was not found","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"cae19ebc8e1b1"}```
I tried both the Order API calls and also the Payment API calls, both ended up with the same error. How do I get this to work. Does it matter that I am using the Paypal Sandbox at the moment for this?
Answer
Solution:
It appears you may be using the deprecated v1 PayPal-PHP-SDK.
Do not use that. The v2 Checkout-PHP-SDK should be used.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: trying to access array offset on value of type bool in
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.