How Payment Works:Reconciliation, Webhooks,Callbacks Flashcards

1
Q

What are webhooks and how do they work?

A

Webhooks are a way for apps to provide real-time information to other applications. They work by sending data to a specified URL as an HTTP request, triggered by specific events within a service or application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What makes webhooks different from typical APIs?

A

Unlike typical APIs that require frequent polling to get real-time data, webhooks are event-driven and deliver data immediately as the event occurs, making them more efficient for real-time updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some common use cases for webhooks?

A

Common use cases for webhooks include notifying a payment system about a transaction, updating a CRM with new contact information, and integrating with continuous integration tools for code updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can users configure webhooks?

A

Users can configure webhooks by specifying which events should trigger them and where the data should be sent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does a webhook work in the context of an e-commerce website updating an inventory management system?

A

In this scenario, when a product is sold on the e-commerce website, the event triggers a webhook. The webhook then sends real-time data about the sale, including product details and quantity, to the inventory management system via an HTTP POST request. The inventory system receives this data and updates its inventory records accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of the reconciliation process in payment services?

A

The reconciliation process in payment services is to verify and validate transactions, ensuring that the payments received match the transactions recorded, and to identify and resolve any discrepancies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the key steps in the reconciliation process for payment services?

A

The key steps include recording transactions, collecting payment data, matching transactions, identifying discrepancies, resolving issues, and finalizing records.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why is identifying discrepancies important in the reconciliation process?

A

Identifying discrepancies is crucial for detecting mismatches due to fees, refunds, errors, or unauthorized transactions, ensuring the accuracy of financial records.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are discrepancies resolved in the reconciliation process?

A

Discrepancies are resolved by investigating the causes, which might involve contacting the payment service or making adjustments in the ledger entries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is short polling in the context of API interactions?

A

Short polling is a method where the client repeatedly requests updates from the server, akin to frequently asking “Are we there yet?” in a long car ride. It’s resource-intensive as it involves constant querying until a response is received.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does long polling differ from short polling?

A

Long polling is like a more patient version of short polling. Here, the server holds a request open and only responds when there’s new information to share. It’s less resource-intensive than short polling but can still strain server resources due to the persistent open connection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are webhooks and how do they improve upon polling methods?

A

Webhooks are a way for servers to notify clients about events. Instead of the client constantly asking the server for updates (polling), the server sends a message to a specified URL provided by the client when there’s new information. This reduces resource wastage and is more efficient than polling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why are webhooks sometimes called reverse or push APIs?

A

Webhooks are often referred to as reverse or push APIs because, unlike traditional APIs where the client requests data from the server, in webhooks, the server pushes data to the client’s specified URL when there’s new or updated information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are some best practices for implementing webhooks?

A

Best practices for webhooks include having a fallback polling mechanism for detecting failed deliveries, securing webhooks with secrets and tokens to prevent unauthorized access, making webhooks idempotent to handle duplicate deliveries, and preparing for webhook traffic surges by using queues.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the limitations of webhooks compared to real-time data solutions?

A

Webhooks may not be ideal for applications requiring real-time data with microsecond latency. In such cases, a persistent socket connection might be preferable, offering push updates with lower overhead, though it is more complex to set up and scale.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When might webhooks not be the ideal solution for data transmission?

A

Webhooks might not be ideal when extremely low-latency, real-time data transmission is required. In such cases, solutions like persistent socket connections, which enable immediate push updates with lower overhead, might be more suitable, though they are more complex to implement and scale.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How can infrastructure be prepared for a surge in webhook traffic?

A

To handle a surge in webhook traffic, especially for high-volume websites, it’s advisable to use queues. This decouples the receiving and processing of webhook events, allowing the system to efficiently manage increased loads and maintain performance during traffic spikes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does it mean to make a webhook idempotent, and why is it important?

A

Making a webhook idempotent means that even if a webhook is delivered more than once, it doesn’t cause issues like duplicate processing. This is important for ensuring the reliability and consistency of the system. Idempotent webhooks typically include unique identifiers to prevent duplicate actions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How does securing webhooks with secrets and tokens enhance security?

A

Using secrets and tokens for webhook endpoints ensures that only authorized entities can trigger the webhook. This authentication process helps prevent malicious attacks and unauthorized access, ensuring that the data being transmitted is secure and trusted.

20
Q

What is the main advantage of using webhooks over polling in terms of server resources?

A

The main advantage of webhooks over polling methods is the significant reduction in server resource usage. While polling continuously asks the server for updates, consuming resources, webhooks send data only when there’s new information, making them much more efficient.

21
Q

How does a persistent socket connection differ from webhook in terms of data transmission?

A

A persistent socket connection, unlike a webhook, establishes a continuous, open line of communication between the client and server. This allows for immediate data transmission with very low latency, ideal for time-sensitive applications, but it is more complex and resource-intensive than webhooks.

22
Q

What is the significance of verifying a webhook call’s signature?

A

Verifying a webhook call’s signature is crucial for ensuring that the data received is actually from the expected source (like Stripe in the example). This verification process helps prevent spoofing attacks and ensures that the information is trustworthy and has not been tampered with.

23
Q

In what scenarios might short polling still be used despite its drawbacks?

A

Short polling might still be used in scenarios where immediate data freshness is not critical, and the application can tolerate the resource overhead. It’s simpler to implement and can be suitable for systems with low traffic or where the server’s load and response times are not a major concern.

24
Q

Why is it important to plan for high-volume webhook traffic for popular websites?

A

Planning for high-volume webhook traffic is important for popular websites to prevent system overloads and ensure smooth operation. Without proper planning, a surge in webhook traffic can lead to delayed processing, server crashes, or data loss, affecting the website’s performance and user experience.

25
Q

How can unique identifiers in webhooks aid in avoiding duplicate processing?

A

Unique identifiers in webhooks help in recognizing and filtering out duplicate messages. By checking these identifiers, the system can easily determine if an incoming webhook event has already been processed, thereby preventing redundant actions and ensuring data consistency.

26
Q

What is the size and precision of a float in Java?

A

A float in Java is a 32-bit single-precision floating-point data type, providing about 6 to 7 decimal digits of precision.

27
Q

What standard does Java use for floating-point numbers?

A

Java uses the IEEE 754 standard for floating-point numbers.

28
Q

How is a float value represented in memory in Java?

A

A float value is represented in memory using 32 bits, divided into three parts: 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa.

29
Q

What is the purpose of the sign bit in a float?

A

The sign bit in a float determines the sign of the number, with 0 for positive numbers and 1 for negative numbers.

30
Q

How does Java represent the exponent in a float?

A

The exponent in a float is stored in an 8-bit field and is expressed in a biased form, with a bias of 127. The actual exponent is calculated by subtracting 127 from the stored exponent value.

31
Q

What is the mantissa in a float, and how is it used?

A

The mantissa in a float represents the significant digits of the number and occupies 23 bits. It is used along with the exponent to form the number’s value.

32
Q

What are the limitations of using a float in Java?

A

The limitations of using a float include rounding errors and precision limitations in representing very large or small numbers, and potential precision loss in iterative calculations.

33
Q

What is epoch time in Java?

A

In Java, epoch time refers to the number of milliseconds since the Unix epoch, which is 00:00:00 UTC on 1 January 1970.

34
Q

What classes in Java can be used to handle epoch time?

A

In Java, classes like Date, Calendar, and Instant (from the Java 8 Date and Time API) can be used to handle epoch time.

35
Q

How do you convert a date to epoch time in Java?

A

To convert a date to epoch time in Java, create a Date object and then use its getTime() method, which returns the epoch time in milliseconds.

36
Q

How do you convert epoch time to a human-readable date in Java?

A

To convert epoch time to a readable date, you can use the Date constructor that takes the epoch time as an argument, or use Instant.ofEpochMilli(epochTime).atZone(ZoneId.systemDefault()).toLocalDateTime() for more control over time zones in Java 8 and later.

37
Q

What are the limitations of using epoch time in Java?

A

The main limitation of using epoch time is its susceptibility to the Year 2038 problem, where systems using 32-bit integers to store epoch time will overflow on 19 January 2038. Also, handling of time zones and leap seconds can be complex.

38
Q

What is local tunneling in computer networking?

A

Local tunneling is a method to expose a server running on a local machine (localhost) to the internet. It allows external devices to access services on your local server through a public URL.

39
Q

Why is local tunneling useful for developers?

A

Local tunneling is useful for developers because it allows them to test their applications using real-world conditions and interactions with external services without having to deploy the application on a public server.

40
Q

How does local tunneling work?

A

Local tunneling works by creating a secure tunnel between a local server and a public endpoint. This is typically done using software that connects to a tunneling service, which then provides a public URL that maps to your localhost server.

41
Q
A
41
Q

What are some common tools used for local tunneling?

A

Common tools for local tunneling include Ngrok, LocalTunnel, and Serveo. These tools provide an easy way to create a secure tunnel from a local port on your machine to a public URL.

42
Q

Is local tunneling secure?

A

Local tunneling can be secure if the tunneling tool or service provides features like HTTPS, authentication, and encrypted tunnels. However, exposing your local server to the internet always carries some risk, so it’s important to follow best security practices.

43
Q

Can local tunneling be used for production environments?

A

Local tunneling is generally not recommended for production environments due to stability, security, and performance concerns. It’s mainly used for development, testing, and demonstration purposes.

44
Q

What are the limitations of using local tunneling?

A

Limitations of local tunneling include potential security risks, dependence on third-party services, limited control over the public URL, and possible performance issues due to the additional layer of tunneling.