Payment seems to be ok, but transaction not showing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have pay button on my eshop. Customer clicks it and he is redirected to PayPal where he can seem total sum and so on. User click pay now and he is successfuly redirected back to eshop. No Error message, but money are not send/recieved.
My code
$clientId = "XXX";
$clientSecret = "XXX";
$environment = new ProductionEnvironment($clientId, $clientSecret);
$client = new PayPalHttpClient($environment);
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = [
"intent" => "CAPTURE",
'reference_id' => $order->id,
"purchase_units" => [[
"amount" => [
"value" => $order->price,
"currency_code" => $currencyCode,
'breakdown' =>
[
'item_total' =>
[
'currency_code' => $currencyCode,
'value' => $order->price,
],
],
],
]],
"application_context" => [
"cancel_url" => $this->siteUrl . "/checkout/cancel/",
"return_url" => $this->siteUrl . "/checkout/paid/" . $order["pay_link"],
'brand_name' => 'Puzzle Mania',
'locale' => 'en-US',
'user_action' => 'PAY_NOW',
]
];
try
{
// Call API with your client and get a response for your call
$response = $client->execute($request);
...
do I someting wrong?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @MKI
Thanks for reaching out to us,
I am sorry to hear that.
Maybe the execute process is not being triggered and the order is just created but not "collected".
In order to execute the payments that you created you need to call the /v2/checkout/orders/{order_id}/capture method. I checked the logs and I see you are correctly creating orders but I can't see any execute call.
-> execute the payment with /v2/checkout/orders/{order_id}/capture
https://developer.paypal.com/docs/api/orders/v2/#orders_capture
You can find at these links our guide with more details:
- https://developer.paypal.com/docs/api/orders/v2/
Could you please open a ticket to us: https://www.paypal-support.com/s/?language=en_US ? This way, we could verify if there's any error on our logs.
I hope this helps.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah I understand now, so when customer clicks pay now and he is redirected to eshop then this code need to be run
$environment = new ProductionEnvironment($clientId, $clientSecret);
$client = new PayPalHttpClient($environment);
Debugger::log("paypal_payment_id:" . $orderFetched["paypal_payment_id"]);
$request = new OrdersCaptureRequest($orderFetched["paypal_payment_id"]);
$request->prefer('return=representation');
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
Debugger::log($response);
}
catch (HttpException $ex)
{
Debugger::log($ex->statusCode);
Debugger::log($ex->getMessage());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @MKI
Thanks for your response,
Yes, of course this will depend on the design and logic on your Website; however the execute method, must be called in order to "complete" the payment.
Thanks,

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Payments Refunded Automatically After Successful Transactions - PayPal Business Account Issue in REST APIs
- Paypal create transaction with QR - API in REST APIs
- Django-paypal form is not showing "pay with credit or debit card" option in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- Shopify PayPal integration, customer authorized multiple times in PayPal Payments Standard
- CHECKOUT.ORDER.APPROVED webhook event not triggered if payment_source is passed in in REST APIs