Paypal Checkout - 付款始终处于待处理状态

Paypal Checkout - Payment always on pending

三天以来,我一直在尝试让 Paypal Checkout 正常工作,但我总是遇到订单已创建且款项从购买账户中消失但未到达收款人账户的问题。 所以这是我的设置:

JavaScript中的智能按钮集成:

paypal.Buttons({
  
  env: enviroment,
  
  // Set up the transaction
  createOrder: function() {

    let formData = new FormData();
    formData.append('bookingId', bookingId);

    return fetch (url_createOrder, {
      method: 'POST',
      body: formData
    }).then(response => {
      console.log(response);
      return response.json()
    })
    .then(function(res) {
      console.log(res);
      return res.result.id;
    });
  },

  // Finalize the transaction
  onApprove: function(data, actions) {
    console.log(data);
    
    // This function captures the funds from the transaction.
    return actions.order.capture().then(function(details) {
      console.log(details);
      // This function shows a transaction success message to your buyer
      // window.location.href = 'danke.php';
    });
  }

}).render('#paypal-button-container');

如您所见,createOrder 启动了对此脚本的 AJAX 调用:

[...]
$client = new PayPalHttpClient($environment);

$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = self::buildRequestBody($price);
// 3. Call PayPal to set up a transaction
$response = $client->execute($request);
echo json_encode($response, JSON_PRETTY_PRINT);

// 4. Return a successful response to the client.
return $response;
}

private static function buildRequestBody($price) {
 return array(
   'intent' => 'CAPTURE',
   'application_context' => array(
      'brand_name' => 'Example',
        'cancel_url' => 'http://localhost/example/abbruch.php',
        'return_url' => 'http://localhost/example/danke.php'
      ),
      'purchase_units' => array(
        0 => array(
          'reference_id' => 'example_addr',
          'description' => 'example Address',
          'amount' => array(
            'currency_code' => 'EUR',
            'value' => $price
          )
        )
      )
    );
[...]

到目前为止一切正常。我得到一个 OrderId,我 return 返回到 AJAX 调用,然后我能够插入凭据并支付给定的价格。

当我完成付款时,JS 文件中智能按钮的 onApprove 被回调,我也得到 actions.order.capture() 的正确 响应:

{create_time: "2020-08-14T19:37:59Z", update_time: "2020-08-14T19:38:20Z", id: "6FP46164U47878440", intent: "CAPTURE", status: "COMPLETED", …}
create_time: "2020-08-14T19:37:59Z"
id: "6FP46164U47878440"
intent: "CAPTURE"
links: [{…}]
payer:
address:
country_code: "DE"
__proto__: Object
email_address: "sb-ughwh2901918@personal.example.com"
name: {given_name: "John", surname: "Doe"}
payer_id: "8Z5RM2ERW6VTL"
__proto__: Object
purchase_units: [{…}]
status: "COMPLETED"
update_time: "2020-08-14T19:38:20Z"
__proto__: Object

之后钱从买家账户中消失,但显示“待定”,这里是屏幕截图(但为德语​​) payment_is_pending.png

在卖家帐户上,我无法select 任何类似“批准”的内容。我找到了一个 paypal checkout api 的例子,它的工作原理类似,并试图将它复制到我的代码中,但是是的......同样的故事。 然后我想也许问题出在卖家沙盒帐户上,但如果我尝试它,一个由 paypal 教程创建和提供的沙盒帐户也说是待定的。

拜托,帮忙!

付款待处理,因为没有电子邮件为 sb-2xact2876961@business.example.com 已确认 的沙盒帐户,因此付款处于无人认领状态。如果无人认领,待处理的无人认领付款将在 30 天后自动退还。

要领取付款,必须通过 https://www.sandbox.paypal.com/businessprofile/settings/email and https://developer.paypal.com/developer/notifications/

在沙盒帐户上确认电子邮件 sb-2xact2876961@business.example.com