Reputation: 1
When I make a sandbox Paypal payment by using my paypal account, it works fine !... I get the notification of the payment in my sandbox.
And thus, If I have a look in the sandbox payment events, I can read the following request path : POST /v2/checkout/orders/0KX86606R2956702X/capture.
When dealing with paypal accounts payments, everything works fine. The problem I face, is when I try to make a payment without using a paypal account, but by using a virtual Credit Card number by using the paypal credit card generator :
https://developer.paypal.com/tools/sandbox/card-testing/#link-testcardnumbers.
While I get a successful transaction from my application, I get no trace of the transaction in the sandbox notification panel. And moreover, If I have a look in the sandbox payment events, I can read the following request path :
POST /v2/checkout/orders ...
so it seems that the request is different compared to the previous one, when dealing with paypal payments.
So I'm lost and I can't understand what happens with credit cards payments while paypal payments work ! what are the difference between the 2 payment solutions ? Any one has an idea to recover the things ? Ipoint out that my paypal profile is professional and then make me allow to receive all king of payments in my account. Many thanks to all for your great ideas ! ;-)
I've tried a paypal sandbox payment by using a paypal account : it works ! I've tried to make a payment by directly using a virtual credit card generator given by paypal : Nothing works
I want to understand what are the differences between the 2 payment solutions and why the result of the transaction is not visible in my sandbox notification panel ? How to recover the things ?
Moreover, see the hereafter detailed info :
I would say, it's a quite simple example of SDK integration. hereafter my "pay.php" code :
use PayPalCheckoutSdk\Core\PayPalHttpClient;
use PayPalCheckoutSdk\Core\SandboxEnvironment;
use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
require __DIR__ . "/vendor/autoload.php";
if (isset($_POST['amount'])) {
$amount = floatval($_POST['amount']);
// Creating an environment
$clientId = PAYPAL_ID;
$clientSecret = PAYPAL_SECRET;
$environment = new SandboxEnvironment($clientId, $clientSecret);
$client = new PayPalHttpClient($environment);
// Construct a request object and set desired parameters
// Here, OrdersCreateRequest() creates a POST request to /v2/checkout/orders
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = [
"intent" => "CAPTURE",
"purchase_units" => [[
"reference_id" => "test_ref_id1",
"amount" => [
"value" => $amount,
"currency_code" => "EUR"
]
]],
"application_context" => [
"cancel_url" => "http://localhost/paypal-checkout-sdk/fail.php",
"return_url" => "http://localhost/paypal-checkout-sdk/success.php"
]
];
try {
// Call API with your client and get a response for your call
$response = $client->execute($request);
// If call returns body in response, you can get the deserialized version from the result attribute of the response
//print_r($response);
// echo '<pre>';
// var_dump($response);
// echo '</pre>';
// die();
$ct = 0;
foreach ($response->result->links as $links) {
$meinlinks[$ct] = $links -> href;
$ct++;
}
// echo '<pre>';
// var_dump($meinlinks);
// echo '</pre>';
header('location:' . $meinlinks[1]); exit;
} catch (HttpException $ex) {
echo $ex->statusCode;
print_r($ex->getMessage());
}
}
I don't know if you see something wrong in my code ? but it works fine when dealing with paypal account only. that's why I ask to myself what's the difference when directly dealing with credit cards?... I have a professional paypal account, and therefore I have the full authorisation related to payment means acceptance. Many thanks for all your appreciated ideas !
Upvotes: 0
Views: 2385