当我尝试以欧元设置付款时,使用 Braintree SDK 的 PayPal 出现问题。无法调试问题

Posted

技术标签:

【中文标题】当我尝试以欧元设置付款时,使用 Braintree SDK 的 PayPal 出现问题。无法调试问题【英文标题】:Problem with PayPal using Braintree SDK when I try set up Payments in Euro. Can't debug problem 【发布时间】:2019-06-24 20:43:20 【问题描述】:

    我创建了启用 EUR、USD 和 PLN 的 PayPal Sandbox 商业账户。

    我创建了与上述帐户相关联的 Sandbox REST API。

    我在帐户 -> 我的用户中关联了 Braintree 沙盒 (https://sandbox.braintreegateway.com/) 中的 Paypal 帐户。

    我在设置 -> 处理 -> PayPal 中输入了 REST API 密钥。

    我确保我的默认商家是 PLN 货币。

    我使用 Braintree .NET 文档为 ClientToken 和 ProcessingNounce 创建了后端方法。

    我使用 Braintree 文档中的 dropin 准备前端。

代码:

braintree.dropin.create(
                authorization: result.token,
                container: '#dropin-braintree-container',
                paypal: 
                    flow: 'checkout',
                    amount: '@Model.TransactionDetails.CalculatedTotalPrice',
                    currency: 'PLN'
                , function (createErr, instance)  ... /* button listener and processing stuff here */ ... );

上面的代码运行良好!我可以使用 Paypal 客户 EUR 账户、Paypal 客户 PLN、Braintree 信用卡等完成交易。

客户告诉我,他不想以 PLN 货币收款,而是以欧元收款,我遇到了麻烦。

我换行了:

currency: 'EUR'

我还将 Braintree 中的默认商家更改为 EUR(没有更改我收到的商家 "The currency of this PayPal transaction must match the currency of the merchant account (2091)"

现在,当我尝试使用任何 PayPal 帐户和其中的任何选项付款时,我收到了"The customer's bank is unwilling to accept the transaction. For credit/debit card transactions, the customer will need to contact their bank for more details regarding this generic decline; if this is a PayPal transaction, the customer will need to contact PayPal. (Declined: 2046)"。我只能使用braintree样本卡完成交易。

无法调试此问题,PayPal 中的 API 调用告诉我有问题,但我无法单击并查看详细信息:

当我在前端代码中切换回 PLN 并在 Braintree 中切换回默认 PLN 商家时,事务再次正常工作。

我需要帮助,无法调试它。如果我遗漏了一些特定于欧元货币的参数,或者它的 PayPal 错误,我想知道。

提前感谢您的帮助!

编辑:我已经深入挖掘,我在Sandbox Api Calls page 的 Chrome 开发工具中检查了 POST 请求以获取详细信息:


   "create_time":"30 Jan 2019 05:07:53",
   "correlation_id":"304384c194ece",
   "resource_id":"PAY-6JB373950C8856440LRI2DGI",
   "api_response":
      "additional_properties":"xxxxxx",
      "body":
         "debug_id":"304384c194ece",
         "details":"xxxxxx",
         "information_link":"https://developer.paypal.com/docs/api/payments/#errors",
         "message":"The request was refused",
         "name":"TRANSACTION_REFUSED"
      ,
      "duration_time":"xxxxxx",
      "header":
         "APPLICATION_ID":"xxxxxx",
         "CALLER_ACCT_NUM":"LG4QN5BPXPW7N",
         "Content-Language":"*",
         "Date":"Wed, 30 Jan 2019 13:07:57 GMT",
         "paypal-debug-id":"304384c194ece"
      ,
      "status":400
   ,
   "client_id":"ASKLWoEWn6q9ZNqkzpj7pulX4x0h9iD-Fy6_yzyfKaiNlHz7VMVwgPlk6Hpaq5-pG3_pcA84qIzOEx9q",
   "api_request":
      "additional_properties":"xxxxxx",
      "body":
         "payer_id":"CCD9AZVEJK8UN",
         "transactions":[
            
               "amount":
                  "currency":"EUR",
                  "total":"22.00"
               ,
               "payment_options":
                  "allowed_payment_method":"IMMEDIATE_PAY"
               
            
         ]
      ,
      "header":
         "accept":"application/json",
         "accept-encoding":"gzip, deflate",
         "authorization":"xxxxxx",
         "client-auth":"No cert",
         "content-length":"152",
         "content-type":"application/json",
         "host":"api.sandbox.paypal.com",
         "paypal-client-metadata-id":"EC-6DS628633U9315453",
         "paypal-request-id":"1548853672_qc053cdc",
         "pp_remote_addr":"xxxxxx",
         "user-agent":"Braintree/1.0",
         "x-ads-si-context":"xxxxxx",
         "x-newrelic-id":"UAMPU1RWGwEJVlNaAQk=",
         "x-newrelic-transaction":"PxQFUVYHXAtTAlhWBwUCUAUHFB8EBw8RVU4aBAoOUgYBXAAFCARRVVMAA0NKQQ8FCFADA1UIFTs=",
         "x-pp-ads-performed":"xxxxxx",
         "x-pp-ads-request-id":"xxxxxx",
         "x-pp-ads-usecase-id":"xxxxxx",
         "x-pp-anomaly-detection-mechanism":"xxxxxx",
         "x-pp-corrid":"304384c194ece",
         "x-pp-idempotencyid":"304384c194ece_1548853673",
         "x-pp-silover":"xxxxxx",
         "x-pp-slingshot-targetapp":"apiplatformproxyserv",
         "x-request-id":"xxxxxx",
         "x-slr-orig-script_uri":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-6JB373950C8856440LRI2DGI/execute"
      ,
      "method":"POST"
   ,
   "account_number":"2117554163912301260",
   "http_status":400,
   "url":"/v1/payments/payment/PAY-6JB373950C8856440LRI2DGI/execute"

根据docs,这个错误基本上可以是任何东西。

EDIT2:

PLN 支付成功请求示例:

  
         "create_time":"30 Jan 2019 06:58:59",
         "correlation_id":"7cabc2b46e5bb",
         "resource_id":"PAY-305699707J366792MLRI3XEA",
         "api_response":  
            "additional_properties":"xxxxxx",
            "body":  
               "cart":"29R95576JY4406634",
               "create_time":"2019-01-30T14:59:03Z",
               "id":"PAY-305699707J366792MLRI3XEA",
               "intent":"sale",
               "links":[  
                    
                     "href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-305699707J366792MLRI3XEA",
                     "method":"GET",
                     "rel":"self"
                  
               ],
               "payer":  
                  "payer_info":  
                     "country_code":"DE",
                     "email":"*****",
                     "first_name":"*****",
                     "last_name":"*****",
                     "payer_id":"CCD9AZVEJK8UN"
                  ,
                  "payment_method":"paypal",
                  "status":"VERIFIED"
               ,
               "state":"approved",
               "transactions":[  
                    
                     "amount":  
                        "currency":"PLN",
                        "details":"xxxxxx",
                        "total":"22.00"
                     ,
                     "payee":  
                        "email":"*****",
                        "merchant_id":"LG4QN5BPXPW7N"
                     ,
                     "payment_options":  
                        "allowed_payment_method":"IMMEDIATE_PAY",
                        "recurring_flag":"xxxxxx",
                        "skip_fmf":"xxxxxx"
                     ,
                     "related_resources":[  
                          
                           "sale":  
                              "amount":  
                                 "currency":"PLN",
                                 "details":  
                                    "subtotal":"22.00"
                                 ,
                                 "total":"22.00"
                              ,
                              "create_time":"2019-01-30T14:59:02Z",
                              "id":"4AK709636U844620F",
                              "links":[  
                                   
                                    "href":"https://api.sandbox.paypal.com/v1/payments/sale/4AK709636U844620F",
                                    "method":"GET",
                                    "rel":"self"
                                 ,
                                   
                                    "href":"https://api.sandbox.paypal.com/v1/payments/sale/4AK709636U844620F/refund",
                                    "method":"POST",
                                    "rel":"refund"
                                 ,
                                   
                                    "href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-305699707J366792MLRI3XEA",
                                    "method":"GET",
                                    "rel":"parent_payment"
                                 
                              ],
                              "parent_payment":"PAY-305699707J366792MLRI3XEA",
                              "payment_mode":"INSTANT_TRANSFER",
                              "protection_eligibility":"ELIGIBLE",
                              "protection_eligibility_type":"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
                              "state":"completed",
                              "transaction_fee":  
                                 "currency":"PLN",
                                 "value":"2.21"
                              ,
                              "update_time":"2019-01-30T14:59:02Z"
                           
                        
                     ]
                  
               ]
            ,
            "duration_time":"xxxxxx",
            "header":  
               "APPLICATION_ID":"xxxxxx",
               "CALLER_ACCT_NUM":"LG4QN5BPXPW7N",
               "Content-Language":"*",
               "Date":"Wed, 30 Jan 2019 14:59:03 GMT",
               "paypal-debug-id":"7cabc2b46e5bb"
            ,
            "status":200
         ,
         "client_id":"ASKLWoEWn6q9ZNqkzpj7pulX4x0h9iD-Fy6_yzyfKaiNlHz7VMVwgPlk6Hpaq5-pG3_pcA84qIzOEx9q",
         "api_request":  
            "additional_properties":"xxxxxx",
            "body":  
               "payer_id":"CCD9AZVEJK8UN",
               "transactions":[  
                    
                     "amount":  
                        "currency":"PLN",
                        "total":"22.00"
                     ,
                     "payment_options":  
                        "allowed_payment_method":"IMMEDIATE_PAY"
                     
                  
               ]
            ,
            "header":  
               "accept":"application/json",
               "accept-encoding":"gzip, deflate",
               "authorization":"xxxxxx",
               "client-auth":"No cert",
               "content-length":"152",
               "content-type":"application/json",
               "host":"api.sandbox.paypal.com",
               "paypal-client-metadata-id":"EC-29R95576JY4406634",
               "paypal-request-id":"1548860338_ae402q2s",
               "pp_remote_addr":"xxxxxx",
               "user-agent":"Braintree/1.0",
               "x-ads-si-context":"xxxxxx",
               "x-newrelic-id":"UAMPU1RWGwEJVlNaAQk=",
               "x-newrelic-transaction":"PxRUBAIHCwsDXFJXVQdVB1YAFB8EBw8RVU4aVFxbUFQCVg9WCQdSA11UBUNKQQ8FCFADA1UIFTs=",
               "x-pp-ads-performed":"xxxxxx",
               "x-pp-ads-request-id":"xxxxxx",
               "x-pp-ads-usecase-id":"xxxxxx",
               "x-pp-anomaly-detection-mechanism":"xxxxxx",
               "x-pp-corrid":"7cabc2b46e5bb",
               "x-pp-idempotencyid":"7cabc2b46e5bb_1548860339",
               "x-pp-silover":"xxxxxx",
               "x-pp-slingshot-targetapp":"apiplatformproxyserv",
               "x-request-id":"xxxxxx",
               "x-slr-orig-script_uri":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-305699707J366792MLRI3XEA/execute"
            ,
            "method":"POST"
         ,
         "account_number":"2117554163912301260",
         "http_status":200,
         "url":"/v1/payments/payment/PAY-305699707J366792MLRI3XEA/execute"
      

【问题讨论】:

【参考方案1】:

我重复了:

1.我创建了启用 EUR、USD 和 PLN 的 PayPal Sandbox 企业帐户。

2.我创建了与上述帐户相关联的 Sandbox REST API。

4. 我在设置 -> 处理 -> PayPal 中输入了 REST API 密钥。 (在 Braintree 沙盒中)

现在可以了。我仔细检查过,设置与以前完全相同。我记得在 1 步骤中我后来添加了欧元货币,所以这可能是某种 PayPal 错误。或者,REST API 应用程序可能不会从帐户更新货币设置。

【讨论】:

以上是关于当我尝试以欧元设置付款时,使用 Braintree SDK 的 PayPal 出现问题。无法调试问题的主要内容,如果未能解决你的问题,请参考以下文章

Braintree 中的 PayPal 按钮无法使用定期付款

Braintree 中的付款方式令牌无效

Braintree:如何使用自定义 UI 选择付款方式并获取付款方式 nonce?

在 Braintree 付款中搜索客户的有效订阅

如何在没有商户账户的情况下使用 Braintree 进行买卖双方的付款?

在Braintree付款中搜索客户的有效订阅