- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello. I am trying to simulate negative response with Orders API v2 through PHP.
<?php
use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
use PayPalCheckoutSdk\Orders\OrdersCaptureRequest;
try {
$orderId = $_GET['order_id'];
$paypalRequest = new OrdersCaptureRequest($orderId);
$paypalRequest->headers['PayPal-Mock-Response'] = '{"mock_application_codes": "DUPLICATE_INVOICE_ID"}';
$client = PayPalClient::client();
$response = $client->execute($paypalRequest);
} catch(\PayPalHttp\HttpException $e){
var_dump($e);
}
When I try to simulate the DUPLICATE_INVOICE_ID reponse, I catch this cool excepetion response:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"issue": "DUPLICATE_INVOICE_ID",
"description": "Duplicate Invoice ID detected. To avoid a potential duplicate transaction your account setting requires that Invoice Id be unique for each transaction."
}
],
"message": "The requested action could not be completed, was semantically incorrect, or failed business validation.",
"debug_id": "70c28ae654da",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-DUPLICATE_INVOICE_ID",
"rel": "information_link",
"method": "GET"
}
]
}
But when I simulate another negative responses, for example CARD_TYPE_NOT_SUPPORTED, I catch this useless response message:
PayPalHttp\HttpException in /home/vagrant/Code/mercadocodigo/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php:215
Why?! How can I get a useful response so I can know what is the error?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for posting to the PayPal Merchant Technical Support Community.
Unless you are processing direct credit cards you will not receive a proper response of CARD_TYPE_NOT_SUPPORTED.
Orders API V2 is setup for PayPal Processing so you will not see that error, which explains when you were completing negative testing you did not see that error response.
Also Negative Testing for Rest API is still in beta so there are options that may not show up when testing.
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for posting to the PayPal Merchant Technical Support Community.
Unless you are processing direct credit cards you will not receive a proper response of CARD_TYPE_NOT_SUPPORTED.
Orders API V2 is setup for PayPal Processing so you will not see that error, which explains when you were completing negative testing you did not see that error response.
Also Negative Testing for Rest API is still in beta so there are options that may not show up when testing.
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response, Jennifer!
Unless you are processing direct credit cards you will not receive a proper response of CARD_TYPE_NOT_SUPPORTED.
Actually I am paying through sandbox account's credit card, and not receiving a proper response of CARD_TYPE_NOT_SUPPORTED.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard
- Pay Pal API Integration in asp.net website using .net framework 4.8 in REST APIs
- PayPal IPN NodeJS production invalid, sandbox is valid in REST APIs
- Setting up transaction from server doesn't work. in SDKs