How can I use negative test using paypal-php-sdk. I try adding the header to the api context but always receive this response:
{
"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
$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
Any suggestions? Thanks
This code worked ok for me:
$apiContext->addRequestHeader("PayPal-Mock-Response", "{'mock_application_codes':'INSTRUMENT_DECLINED'}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With