200-901 Question 39
Select 4A developer is building an application that integrates with a third-party payment processing service. The service provides webhook functionality to notify the application about events like successful transactions or payment failures. What are the typical usage patterns for handling such webhooks in the application?
- A
Listen for webhook events using an HTTP endpoint exposed by the application.
- B
Poll the payment processing service periodically for updates instead of relying on webhooks.
- C
Verify the authenticity of the webhook payload using a shared secret or signature.
- D
Respond to the webhook with a proper HTTP status code to acknowledge receipt of the event.
- E
Store the webhook data in a database for further processing and auditing.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
Webhooks are used to notify applications about events in real-time. To effectively handle webhooks, developers must expose an HTTP endpoint to receive them, verify the payload's authenticity for security, acknowledge receipt by responding with a proper HTTP status code, and optionally store the data for further use. Polling is not a webhook-related pattern, as webhooks are specifically designed to replace the need for such periodic requests.
- A. Correct.
Correct: Webhooks require the application to expose an HTTP endpoint to receive event notifications from the third-party service.
- B. Incorrect.
Incorrect: Polling is not a typical usage pattern for webhooks, as webhooks are designed to eliminate the need for periodic polling by pushing events to the application.
- C. Correct.
Correct: Verifying the authenticity of the webhook payload is crucial to ensure the event came from a trusted source and was not tampered with.
- D. Correct.
Correct: Sending an HTTP status code (like 200 OK) is necessary to acknowledge receipt of the webhook, allowing the sender to know the notification was successfully delivered.
- E. Correct.
Correct: Storing webhook data is a common practice for further processing, auditing, or troubleshooting purposes.