贝宝结帐 returns UNPROCESSABLE_ENTITY

PayPal chectout returns UNPROCESSABLE_ENTITY

我的结帐代码

let ORDERPRICE = 2;
paypal.Buttons({
    createOrder: function(data, actions) {
        return actions.order.create({
            application_context: {
                shipping_preference: "NO_SHIPPING",
                brand_name: "MYCOMP",
                user_action: 'PAY_NOW',
                payment_method: {
                    payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED'
                }
            },
            payer: {
                name: {
                    given_name: 'NAME'
                },
                email_address: 'EMAIL@EMAIL.com'
            },
            purchase_units: [{
                description: "description",
                amount: {
                    currency_code: 'EUR',
                    value: ORDERPRICE
                }
            }]
        });
    },
    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
          //submitting my form to show thank you page
        var sentform = document.getElementById('booking-sent');
        sentform.submit();
      });
    },
    style: {
                color:  'blue'
            }
  }).render('#paypal-button-container');

在浏览器调试中,我看到 POST 到 https://www.paypal.com/smart/api/order/23H57866L56525306/capture 我从 PayPal

得到了答复
    {"ack":"contingency","contingency":"UNPROCESSABLE_ENTITY","data":
    {"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"TRANSACTION_REFUSED","description":"The request was refused"}],
"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"282422b19213c",
    "links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-TRANSACTION_REFUSED","rel":"information_link","method":"GET"}]},"meta":{"calc":"282422b19213c","rlog":"rZJvnqaaQhLn%2FnmWT8cSUueWscmrtUHe5Y1Bd%2FeqyvyOTq66rSXAcnM25I5c5rd3HxcyHxUk51TwoDOk%2By6wR%2Bw1HIUZ5ikN_17823c767ad"},"server":"OIZ58dNapHV5upm8ATCTYU49pCRnWLUsUjSypMRTXJSK5O3nEGxxJcKhByP9VmJq8cMcxl0h826w9SamyEn7niIWkJCJ_dYRHcQcnfMQSPWr2KIOUwJTg_fz4H6p100NKDfIiTBVCsopCu5fUadAqZMpyXvcJvyrj70N6Vvp9rMUXBfLj7d7HnDtxtM_0wO0JUB8gZUJzNmGTn6283Qwandfgn1LcTH6mnja87iXsKVRSFcuLVmSXDOWbhZ3Bh0Dk9hD5ihBeK4T9DYh5TCqe0"}

当我要去 https://developer.paypal.com/docs/api/orders/v2/#error-TRANSACTION_REFUSED 时,不知道该做什么。

交易被拒绝。

可能它被拒绝的部分原因是您指定:

            payment_method: {
                payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED'
            }

由于各种可能的原因,它将 'pending'(不是立即的)。

原因是企业帐户设置。以上代码完全没问题。

您需要注意的设置是货币。更具体地说,您需要指出您(作为企业帐户)接受的所有货币。在这种情况下,我已将欧元 (EUR) 设置为付款货币。同时,企业帐户默认仅将美元 (USD) 设置为可接受的货币