【问题标题】:Paypal Checkout - Payment always on pendingPaypal Checkout - 付款始终处于待处理状态
【发布时间】:2020-12-04 17:38:11
【问题描述】:

三天以来,我一直在尝试让 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,我返回到 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

在卖家帐户上,我无法选择“批准”之类的内容。我找到了一个类似 paypal checkout api 的示例,并试图将其复制到我的代码中,但是是的……同样的故事。 然后我认为问题可能出在卖家沙盒帐户上,但如果我尝试使用 paypal 教程创建和提供的沙盒帐户也显示待处理。

请帮忙!

【问题讨论】:

    标签: javascript php paypal paypal-sandbox checkout


    【解决方案1】:

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

    要索取付款,电子邮件 sb-2xact2876961@business.example.com 必须在沙盒帐户上通过https://www.sandbox.paypal.com/businessprofile/settings/emailhttps://developer.paypal.com/developer/notifications/ 进行确认

    【讨论】:

      猜你喜欢
      • 2014-07-04
      • 2017-08-18
      • 1970-01-01
      • 2023-03-19
      • 2013-03-06
      • 2017-02-11
      • 2013-06-30
      • 2014-09-20
      • 1970-01-01
      相关资源
      最近更新 更多