Paypal authorise rest api in php - Stack Overflow

admin2025-04-16  5

$authResponse = Http::withToken($accessToken)->post("{$this->baseUrl}/v1/payments/payment", ["intent" => "authorize","payer" => ["payment_method" => "credit_card","funding_instruments" => [["credit_card_token" => ["credit_card_id" => $cardId]]]],"transactions" => [["amount" => ["total" => "1.00","currency" => "USD"],"description" => "Card verification test"]]]);`

When I call this api to authorise payment response is like

"Payee is Invalid"

Although at first I get token successfully if payee were invalid then why token api would be successfull.

$authResponse = Http::withToken($accessToken)->post("{$this->baseUrl}/v1/payments/payment", ["intent" => "authorize","payer" => ["payment_method" => "credit_card","funding_instruments" => [["credit_card_token" => ["credit_card_id" => $cardId]]]],"transactions" => [["amount" => ["total" => "1.00","currency" => "USD"],"description" => "Card verification test"]]]);`

When I call this api to authorise payment response is like

"Payee is Invalid"

Although at first I get token successfully if payee were invalid then why token api would be successfull.

Share Improve this question edited Feb 2 at 20:00 VLAZ 29.2k9 gold badges63 silver badges84 bronze badges asked Feb 2 at 8:44 The VottuxThe Vottux 211 bronze badge 1
  • log the entire request and entire response, in JSON format – Preston PHX Commented Feb 2 at 17:01
Add a comment  | 

1 Answer 1

Reset to default 1

The "Payee is Invalid" error usually indicates that the recipient (merchant account) specified for the transaction is incorrect or not eligible to receive payments. The token you received initially is only for authentication, not for transaction validation.

  1. Ensure that your PayPal (or other payment provider) merchant account is set up correctly and is eligible to receive payments.

  2. Make sure you are using the correct API URL for payments:

    "{$this->baseUrl}/v1/payments/payment"

Make sure $this->baseUrl is set correctly (https://api.sandbox.paypal.com for testing or https://api.paypal.com for live).

转载请注明原文地址:http://anycun.com/QandA/1744806482a87879.html