Listen for checkout warnings from Paddle.js
Get details about invalid or missing information passed to a checkout when opening, so you can handle it in your frontend.
What's new?
We added a new checkout.warning
event for Paddle.js. It's emitted when there's a problem with a checkout that doesn't stop the checkout from opening, like invalid or missing information was passed.
How it works
When opening a checkout, you can pass data to prefill properties or set optional settings. For example, you might capture country or email address on a landing page before a prospect interacts with your checkout. You can pass this data to Paddle.js when opening to prefill it, meaning a customer doesn't need to re-enter information.
If you pass data that isn't valid, or pass incomplete data, then Paddle Checkout opens but doesn't include any prefilled information.
You can now listen for the new checkout.warning
event emitted by Paddle.js to get information about what was wrong with the information that was passed. This is especially useful for inline checkout integrations, where you have more control over the design of the page and might like to display a custom error message.
Examples
123456789101112131415161{
2 "type": "checkout.warning",
3 "code": "checkout_creation_invalid_field",
4 "detail": "Invalid values for fields in request",
5 "documentation_url": "https://developer.paddle.com/errors/product/product_invalid_field",
6 "errors": [
7 {
8 "field": "/data/settings/locale",
9 "message": "The locale must be a supported locale."
10 },
11 {
12 "field": "/data/discount_id",
13 "message": "The discount id must be a valid paddle id."
14 }
15 ]
16}
Next steps
This change is live in Paddle.js now, so you can start listening for checkout.warning
when you're ready.
You don't need to do anything to get the latest version of Paddle.js — we serve the latest version automatically.