[英]PayPal-Mock-Response in paypal-php-sdk
How can I use negative test using paypal-php-sdk. 如何使用paypal-php-sdk进行负面测试。 I try adding the header to the api context but always receive this response: 我尝试将标头添加到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."
}
]
}
I sent in header 我发了标题
PayPal-Mock-Response: {"mock_application_codes":"AUTHORIZATION_VOIDED"}
And in my php code 在我的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"]);
The full list of TESTING INPUT at https://developer.paypal.com/docs/api/payments/#errors 有关测试输入的完整列表,请访问https://developer.paypal.com/docs/api/payments/#errors
Any suggestions? 有什么建议么? Thanks 谢谢
这段代码对我有用:
$apiContext->addRequestHeader("PayPal-Mock-Response", "{'mock_application_codes':'INSTRUMENT_DECLINED'}");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.