paypal-php-sdk中的PayPal-Mock-Response
作者:互联网
如何使用paypal-php-sdk进行负面测试.我尝试将标头添加到api上下文,但始终收到此响应:
{
"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."
}
]
}
我发了标题
PayPal-Mock-Response: {"mock_application_codes":"AUTHORIZATION_VOIDED"}
在我的PHP代码中
$i_header["header"] = "PayPal-Mock-Response";
$i_header["value"] = json_encode(["mock_application_codes" => "INSTRUMENT_DECLINED"]);
$o_apiContext->addRequestHeader($i_header["header"], $i_header["value"]);
测试输入的完整列表
https://developer.paypal.com/docs/api/payments/#errors
有什么建议?谢谢
解决方法:
这段代码对我有用:
$apiContext->addRequestHeader("PayPal-Mock-Response", "{'mock_application_codes':'INSTRUMENT_DECLINED'}");
标签:php,paypal,paypal-sandbox 来源: https://codeday.me/bug/20190710/1427124.html