PayPal REST API über PHP SDK-Rückgabe "Eingehende JSON-Anforderung wird nicht der API-Anforderung zugeordnet"
Ich versuche, eine Zahlung mit PayPal REST API über PHP SDK (Sandbox-Umgebung) zu erstellen und auszuführen (siehe unten). Die Zahlungserstellung $payment->create
) funktioniert gut, aber die Zahlungsausführung $payment->execute
) Rückkehr"Incoming JSON request does not map to API request"
. Die JSON-Anforderung wird vom SDK erstellt. Woran kann das liegen? Danke im Voraus
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$item = new Item();
$item->setName('Any name')
->setCurrency('EUR')
->setQuantity(1)
->setPrice(0.99);
$itemList = new ItemList();
$itemList->setItems(array($item));
$details = new Details();
$details->setTax(0)
->setSubtotal(0.99);
$amount = new Amount();
$amount->setCurrency('EUR')
->setTotal(0.99)
->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription('Any description')
->setInvoiceNumber(uniqid());
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(BASE_URL.'/payment/?success=true')
->setCancelUrl(BASE_URL.'/payment/?success=false');
$payment = new Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
try {
$payment->create($apiContext);
$execution = new PaymentExecution();
$result = $payment->execute($execution, $apiContext);
} catch (Exception $ex) {
//Function for extract the error message,
//the error message can be showing with
//a simple var_dump($ex)
$exception = self::getException($ex);
}