本文介绍了如何使用Paypal Rest API解决400错误的请求错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用PayPal Payments Pro Rest API测试信用卡付款.

I am currently testing credit card payments using the PayPal payments pro Rest API.

我一直收到以下错误:

HttpConnection中的异常执行:无效的HTTP响应远程服务器返回错误:(400)错误的请求. --->

Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (400) Bad Request. --->

我创建并激活了我的PayPal测试帐户,如下所示:

I created and activated my PayPal test account and as following:

信用卡信用卡号码:ccnumber在这里信用卡类型:签证截止日期:3/2019

Credit cardCredit card number:ccnumber hereCredit card type:VisaExpiration date:3/2019

当我在付款表格中输入以上信息并提交时,我不断收到400错误的请求错误.

When I enter the above information in my payment form and submit I keep getting the 400 bad request error.

在使用PayPAl joe购物者帐户之前,我已经开始使用此功能,但是却丢失了测试抄送号码.

I have gotton this to work before with the PayPAl joe shopper account but lost the test cc number.

我100%确认我已经使用oauth2凭据进行了身份验证

I am 100% sure I have authenticated with the oauth2 credentials

此错误的可能原因是什么?:

What is the likely cause of this error?:

我要输入随机付款人的名字和姓氏.

I am entering a random payer first name and last name .

这个名字必须存在吗?

什么可能导致错误

推荐答案

如果给定数据中出现任何错误,paypal api将返回400-错误的请求错误.

If anything goes wrong in the data given, paypal api will return a 400 - Bad request error.

当我收到错误(PHP SDK)时,我捕获了异常,并且$ex->getData()返回了一个json,其中包含有关错误请求的详细信息,在我的情况下,我给出的货币代码是错误的.

When I got the error(PHP SDK), I caught the exception and $ex->getData() returned a json which contains the details about the bad request, in my case the currency code I given was wrong.

    try {
        $payment->create($apiContext);
    } catch (PayPal\Exception\PPConnectionException $ex) {
        var_dump(json_decode($ex->getData()));
        exit(1);
    }

这篇关于如何使用Paypal Rest API解决400错误的请求错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:58