Two types of errors
Before implementing error handling, it’s important to understand the difference between validation errors and payment failures:Default error behavior
- Web
- Android
- iOS
The
<primer-error-message-container> specifically handles payment failures that occur after form submission, not card validation errors. Card validation is handled by the input components themselves and prevents form submission until valid.Built-in error display
- Web
- Android
- iOS
The For optimal user experience, place the error container:
<primer-error-message-container> provides a convenient way to display payment failures without writing custom code:- Prominently where it will be visible after a payment attempt
- Near the action where users will naturally look for feedback after submitting payment
- In context within the same visual area as the payment method it relates to
Error properties
Every error from the SDK includes diagnostic information to help identify and resolve issues.- Web
- Android
- iOS
Custom error handling
- Web
- Android
- iOS
You can implement your own payment failure handling using the SDK callbacks and events. Choose one of the following approaches:This approach gives you complete control over payment failure presentation but requires you to implement the error handling logic yourself.
- Callbacks (primer:ready)
- State change event
Choosing the right approach
Best practices
See also
Error message container
Web component SDK reference
Android SDK reference
Android SDK API documentation
Events guide
Complete reference for all checkout events
Log Errors Guide
Capture and log payment errors for debugging