为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

PHP
慕慕森 2023-10-15 14:56:48
三天以来,我试图让 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 调用,然后我就可以插入凭据并支付给定的价格。
查看完整描述

1 回答

?
慕尼黑5688855

TA贡献1848条经验 获得超2个赞

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

查看完整回答
反对 回复 2023-10-15
  • 1 回答
  • 0 关注
  • 113 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信