- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am following [this PayPal Checkout's guide to set up transaction through server integration](https://developer.paypal.com/docs/checkout/reference/server-integration/set-up-transaction/).
I need to interrupt the transaction flow when some validation fails on the server.
On the server:
if($this->validate() == false){
return response()->json(['validationError' => true]);
}
On the client:
paypal.Buttons({
createOrder: function() {
return fetch('/my-server/create-paypal-transaction', {
method: 'post',
headers: {
'content-type': 'application/json'
}
}).then(function(res) {
return res.json();
}).then(function(data) {
if(data.hasOwnProperty('validationError')){
return false; // I GUESS I NEED TO RETURN SOMETHING TO INTERRUPT TRANSACTION HERE, BUT WHAT?
}
return data.orderID;
});
},
onError: function (err) {
// Show an error page here, when an error occurs
}
}).render('#paypal-button-container');
By doing that, **the PayPal window is launched and immediately closed: this is the main issue what I want to avoid**. And I get this error on client console:
update_client_config_error
Object { err: "Expected an order id to be passed\nze/</<@https://www.sandbox.paypal.com/smart/buttons?locale.lang=pt&locale.country=BR&style.label=pay&style....", timestamp: "1579888892327", referer: "www.sandbox.paypal.com", buttonSessionID: "70540b6b82_mtg6mde6mjy", sessionID: "4462f1e2f2_mtc6ntm6ndy", env: "sandbox" }
buttons:928:21581
unhandled_error
Object { err: "Expected an order id to be passed\nze/</<@https://www.sandbox.paypal.com/smart/buttons?locale.lang=pt&locale.country=BR&style.label=pay&style....", timestamp: "1579888892433", referer: "www.sandbox.paypal.com", buttonSessionID: "70540b6b82_mtg6mde6mjy", sessionID: "4462f1e2f2_mtc6ntm6ndy", env: "sandbox" }
buttons:928:21581
Error: Expected an order id to be passed
So, how to interrupt PayPal Checkout transaction flow through server integration without errors on client?
Solved! Go to Solution.
- Labels:
-
API
-
Express Checkout
-
Payouts
-
REST
-
SDK
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for posting to the Merchant Technical Support Community.
If you are trying to interrupt the PayPal Checkout to create a confirmation page, here is the information:
https://developer.paypal.com/docs/checkout/integration-features/confirmation-page/
That would one way to interrupt the checkout is to force a confirmation page. If you have a confirmation page then your customers would be redirected to your confirmation page after choosing their funding method through PayPal.
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 Merchant Technical Support Community.
If you are trying to interrupt the PayPal Checkout to create a confirmation page, here is the information:
https://developer.paypal.com/docs/checkout/integration-features/confirmation-page/
That would one way to interrupt the checkout is to force a confirmation page. If you have a confirmation page then your customers would be redirected to your confirmation page after choosing their funding method through PayPal.
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Whilst useful information, this isn't answering the original question.
I'm in a similar situation where I want to prevent the unhandled_error console error if an order id cannot be created via the createOrder method on the server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Advanced checkout and no 3DS information in the response in REST APIs
- PayPal Redirection Issue After Successful Payment in Photobooth Integration in Sandbox Environment
- How do I offer PayPal Pay Later button on my website? in PayPal Payments Standard
- How do I generate PayPal Client ID & Secret Key? in REST APIs
- PayPal integration in PayPal Payments Standard