Php Paypal结账-交易数据-仅返回PayGrid

Php Paypal结账-交易数据-仅返回PayGrid,php,web,paypal,Php,Web,Paypal,第一次集成paypal,如果这是一个糟糕的问题,很抱歉。我制作了一个使用php作为后端的商店页面,这是我购买单件商品的代码: <form action="<?php echo PAYPAL_URL; ?>" method="get"> <!-- Identify your business so that you can collect the payments. -->

第一次集成paypal,如果这是一个糟糕的问题,很抱歉。我制作了一个使用php作为后端的商店页面,这是我购买单件商品的代码:

<form action="<?php echo PAYPAL_URL; ?>" method="get">
                <!-- Identify your business so that you can collect the payments. -->
                <input type="hidden" name="business" value="<?php echo PAYPAL_ID; ?>">
                
                <!-- Specify a Buy Now button. -->
                <input type="hidden" name="cmd" value="_xclick">
                
                <!-- Specify details about the item that buyers will purchase. -->
                <input type="hidden" name="item_name" value="dev_test_item">
                <input type="hidden" name="item_number" value="2">
                <input type="hidden" name="amount" value="10">
                <input type="hidden" name="currency_code" value="EUR">
                
                <!-- Specify URLs -->
                <input type="hidden" name="return" value="http://localhost/doda/success.php">
                <input type="hidden" name="cancel_return" value="http://localhost/doda/cancel.php">
                
                <!-- Display the payment button. -->
                <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif">
            </form>
您获得的对象是“付款”-您需要使用付款人id执行该付款


您使用的是哪一个API?我应该将这段代码放在哪里?Success.php?警告:require(C:\xampp\htdocs\test/。/bootstrap.php):打开流失败:在第2行的C:\xampp\htdocs\test\Success.php中没有这样的文件或目录致命错误:require():无法打开所需的“C:\xampp\htdocs\test/。/bootstrap.php”(include_path='C:\xampp\php\PEAR')在第2行的C:\xampp\htdocs\test\success.php中,您当前在哪里处理数据?您使用的是什么API?PayPal有几个。@Feyton您不能只是将示例代码片段复制并粘贴到当前应用程序中,然后期望它解决您的编码问题。这根本不是编程。你应该非常小心,编码错误的支付内容可能会产生非常负面的影响,如果集成错误,你或其他人可能会赔钱。
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\ExecutePayment;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
use PayPal\Api\Transaction;

// Get payment object by passing paymentId
$paymentId = $_GET['paymentId'];
$payment = Payment::get($paymentId, $apiContext);
$payerId = $_GET['PayerID'];

// Execute payment with payer ID
$execution = new PaymentExecution();
$execution->setPayerId($payerId);

try {
  // Execute payment
  $result = $payment->execute($execution, $apiContext);
  var_dump($result);
} catch (PayPal\Exception\PayPalConnectionException $ex) {
  echo $ex->getCode();
  echo $ex->getData();
  die($ex);
} catch (Exception $ex) {
  die($ex);
}