paypal-php-sdk中的PayPal-Mock-Response

时间:2017-08-30 16:15:58

标签: php paypal paypal-sandbox

如何使用paypal-php-sdk进行负面测试。我尝试将标头添加到api上下文中,但始终收到此响应:

__getattribute__

我发送了标题

{
    "name": "INVALID_NEGATIVE_TESTING_INPUT",
    "message": "Invalid input found. See the following supported cases.",
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/nt-rest/",
            "rel": "information_link"
        }
    ],
    "details": [
        {
            "issue": "You must use a valid URL supported by negative testing."
        }
    ]
}

在我的PHP代码中

PayPal-Mock-Response: {"mock_application_codes":"AUTHORIZATION_VOIDED"}

TESTING INPUT的完整列表 https://developer.paypal.com/docs/api/payments/#errors

有什么建议吗?感谢

1 个答案:

答案 0 :(得分:0)

此代码对我来说没问题:

$apiContext->addRequestHeader("PayPal-Mock-Response", "{'mock_application_codes':'INSTRUMENT_DECLINED'}");