How Do APIs Work?


PayPal’s Name Value Pair (NVP) API

Exhibit 25.4   PayPal’s Name Value Pair (NVP) API. Source: O’Reilly

To understand how APIs work, consider the process of purchasing a product online using a third-party payment service like PayPal. When a buyer selects “Pay with PayPal”, the website sends a request to PayPal through an API. The API processes the request, transferring it to the PayPal server, which then returns the necessary information. The website receives the data from PayPal and completes the transaction seamlessly.

As shown in Exhibit 25.4, these interactions can be broken down into the following steps:

  1. Site establishes a session with PayPal when user clicks “Pay with PayPal”.
  2. Site redirects buyer to PayPal for shipping and payment information.
  3. Buyer confirms transaction on PayPal.
  4. PayPal redirects the buyer back to the Site.
  5. Site issues request to PayPal for final payment processing.

Throughout this process, the API acts as an intermediary, handling the data exchange without exposing the complexities to the user. The user only sees a smooth transaction, while the API manages the underlying communication between the web application and the payment service.


Previous     Next

Use the Search Bar to find content on MarketingMind.