Non-FictionFirst 30 DaysPayment Integration

PayPal REST API Guide eBook

Implement PayPal REST API for orders, payments, an

by Burks Ilse

  • English
  • 153 pages
  • 2026
  • SamEnrico

Implement PayPal REST API for orders, payments, and refunds. Handle OAuth2 and webhook verification.

Formats

Free sample

Chapter 1: The Hybrid Reality--–- Most developers discover Pay Pal’s API documentation the same way: staring at a browser tab titled “REST API Reference,” feeling a creeping sense of dread that they’re about to build something critical on a foundation they don’t fully understand. You’ve read the tutorials. You’ve seen the Stack Overflow posts. You know that someone, somewhere, lost money because they used the wrong endpoint or forgot to verify a webhook. And now it’s your turn.This chapter exists to ensure that when you finish this book, you are not that person.But before you write a single line of code, before you generate your first access token, you need to understand something that Pay Pal’s documentation dances around but never states clearly: the Pay Pal REST API is not fully versioned.

You will use v2 endpoints for payments and orders. You will use v1 endpoints for authentication, webhooks, reporting, and payouts. And if no one explains this to you upfront, you will waste hours debugging errors that are not your fault.Welcome to the hybrid reality.The Three Questions Every Developer Asks First Before we dive into endpoints and JSON payloads, let’s answer the three questions that determine whether your integration will take three days or three weeks.Question 1: Why does Pay Pal have multiple APIs, and which one do I use?Pay Pal has been processing payments since 1998. That means they have legacy systems older than most of their developers. Over the years, they’ve released:NVP/SOAP APIs (2000s): Verbose, stateful, XML-based.

Officially deprecated. Do not use.Pay Pal Payments Standard (2000s): Button-based, limited control. Fine for donation pages. Not for serious e-commerce.Express Checkout (2010s): Better than Standard but still limited. Being phased out.REST API (2013–present): JSON-based, stateless, the future.

This is what you’re here for.But even the REST API has a split personality. The original REST API (v1) had a resource called /v1/payments/payment. It worked. It still works today, technically. But it is deprecated, and Pay Pal has explicitly stated that new features will only be added to v2.

If you start a new integration on v1 today, you are building on borrowed time.Question 2: What is the difference between Sale, Authorize, and Order patterns?In the old v1 API, you had three distinct intent values:sale: Immediate capture. One API call.authorize: Hold funds, capture later. Two calls separated by time.order: A more complex pattern that allowed multiple captures and re-authorizations.In v2, sale no longer exists as a single API call. You achieve the same result with intent: "CAPTURE" followed by a capture call. This is not a bug.

It is a deliberate design choice that forces you to separate order creation from payment execution – a pattern that actually reduces errors in production.Question 3: How much does this cost?Pay Pal does not charge for API calls. You pay the same transaction fees (typically 2.99% + $0.49 in the US) whether you use their hosted buttons or the REST API. The API itself is free. The mistakes you make – duplicate charges, failed captures, unverified webhooks – are not.The v1/v2 Hybrid Reality: Why You Need Both Let me be brutally clear about what you will and will not use from each version.What You Use from v2 (The Modern Core)Operation Endpoint Notes Create order POST /v2/checkout/orders Primary entry point Capture payment POST /v2/checkout/orders/{id}/capture After buyer approval Get order details GET /v2/checkout/orders/{id}Check status Authorize for later capture POST /v2/checkout/orders with intent: AUTHORIZEDelayed fulfillment Capture authorization POST /v2/payments/authorizations/{id}/capture After authorization hold Reauthorize POST /v2/payments/authorizations/{id}/reauthorize Extend expiring hold Void authorization POST /v2/payments/authorizations/{id}/void Cancel before capture Process refund POST /v2/payments/captures/{id}/refund Full or partial Every payment-related operation in this book uses v2 endpoints. The request and response formats are consistent, JSON-based, and well-documented.

If you only learn one version, learn v2.What You Use from v1 (The Supporting Cast)Operation Endpoint Why It's Still v1Get access token POST /v1/oauth2/token Authentication is a stable, separate service Register webhook POST /v1/notifications/webhooks Notifications API predates v2List webhooks GET /v1/notifications/webhooks Same reason Verify webhook signature POST /v1/notifications/verify-webhook-signature Critical security, still v1Look up missed webhooks GET /v1/notifications/webhooks/{id}/events Recovery endpoint Search transactions GET /v1/reporting/transactions Reporting is separate from payments Get balances GET /v1/reporting/balances Same reason Send payouts POST /v1/payments/payouts Mass payments use different infrastructure Here is the critical insight that no other book tells you: Pay Pal’s versioning strategy is not “everything moves to v2.” It is “the payments domain moves to v2; infrastructure and reporting stay on v1.” If you try to use v2 for authentication, you will fail. If you try to use v2 for webhook verification, you will fail. The endpoints simply do not exist.This is not inconsistency. It is architectural reality. Accept it, document it in your team’s onboarding materials, and move on.The Three Integration Patterns (Corrected for v2)Let me restate the patterns in a way that matches what actually works today.Pattern 1: Immediate Capture (Replaces v1 "Sale")Use case: Digital downloads, event tickets, any product delivered instantly after payment.How it works in v2:Create order with intent: "CAPTURE"Redirect buyer to Pay Pal approval URLAfter buyer approves, call capture endpoint Funds move immediately Number of API calls: 2 (create + capture)Why not 1?

Because Pay Pal wants you to separate the buyer’s approval from the actual money movement. This protects you: if your capture fails, you haven’t taken money. In the old v1 Sale pattern, a network error between the approval and your confirmation could leave you uncertain.Pattern 2: Authorize and Capture (Delayed Fulfillment)Use case: Physical products, custom orders, any scenario where you ship days or weeks after purchase.How it works in v2:Create order with intent: "AUTHORIZE"Redirect buyer to Pay Pal approval URLAfter approval, Pay Pal places a hold (reduces available credit)When ready to ship, call POST /v2/payments/authorizations/{id}/capture Funds move at that moment Number of API calls: 2 (create) + 1 per capture Hold duration: 29 days. After that, the hold expires and you cannot capture. Use re-authorization to extend.Pattern 3: Order with Multiple Captures Use case: Split shipments, backordered items, any scenario where you charge in parts.How it works in v2:Create order with intent: "AUTHORIZE" or "CAPTURE"After approval, capture partially (e.g., 50% now)Later, capture remaining amount (if using authorize pattern)Or, if using capture pattern, you cannot capture more than the original amount (partial is for less only)Critical limitation: With intent: "CAPTURE", you can only capture once.

With intent: "AUTHORIZE", you can capture multiple times up to the authorized total. Choose based on whether you know the final amount upfront.The Decision Matrix: Which Pattern to Use Use this matrix to make your choice. There is no “always correct” answer. The right pattern depends on your business model.Your Scenario Recommended Pattern Why Digital download, immediate delivery Immediate Capture No reason…

This is the end of the free sample. Get the eBook to keep going. Buy now

About this book

Implement PayPal REST API for orders, payments, and refunds. Handle OAuth2 and webhook verification.

Details

Author
Burks Ilse
Publisher
SamEnrico
Language
English
Genre
Non-Fiction, First 30 Days, Payment Integration
Released
2026-05-30
Pages (approx.)
153
Available as
eBook, Audiobook

Read better in the ZLOADR app

Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.

More by Burks Ilse

See all

You may also like

See all