Paypal Checkout - 付款始终处于待处理状态 [英] Paypal Checkout - Payment always on pending

查看:574
本文介绍了Paypal Checkout - 付款始终处于待处理状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从三天以来,我一直试图让 Paypal Checkout 工作,但我总是遇到订单已创建且资金从购买帐户中转入但未到达收款人帐户的问题.所以这是我的设置:

Since three days i am trying to get the Paypal Checkout to work but i always have the problem that the order is created and the money in gone from the buying account but not reaching the payee account. So here is my setup:

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 调用,然后我可以插入凭据并支付给定的价格.

Everything works so far to this point. I get a OrderId back which i return to the AJAX call and then i am am able to insert credentials and pay the given price.

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

When i finish the payment the onApprove of the smart buttons in the JS file get called back and i also get the correct response of that 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

Afterwards the money is gone from the buyer account but it says "pending", here a screenshot (but in german) payment_is_pending.png

在卖家帐户中,我无法选择批准"之类的选项.我找到了一个paypal checkout api的例子,它的工作原理类似,并试图将它复制到我的代码中,但是是的……同样的故事.然后我想问题可能出在卖家沙箱帐户上,但如果我尝试一下,哪个由贝宝教程创建和提供的沙箱帐户也说待处理.

On the seller account i can´t select anything like "approve". I found an example of the paypal checkout api which works similar and tried to copy it into my code but yeah... same story. Then i thought maybe the problem is the seller sandbox account, but if i try it which an sandbox account created and given by a paypal tutorial is says pending as well.

请帮忙!

推荐答案

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

The payments are pending because there is no sandbox account with the email sb-2xact2876961@business.example.com confirmed, so the payments are in an unclaimed state. Pending unclaimed payments will be automatically returned after 30 days if left unclaimed.

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

To claim the payments, the email sb-2xact2876961@business.example.com must be confirmed on a sandbox account, via https://www.sandbox.paypal.com/businessprofile/settings/email and https://developer.paypal.com/developer/notifications/

这篇关于Paypal Checkout - 付款始终处于待处理状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆