PayPal Integration
Seamless PayPal payment integration for your website or app — Smart Buttons, Express Checkout, recurring subscription billing, and webhook-driven payment lifecycle management.
What's Included
PayPal Integration
PayPal is one of the most trusted digital payment platforms worldwide, with over 400 million active accounts across 200+ markets and 25 currencies. Integrating PayPal into your website or application instantly extends your reach to a massive, ready-to-pay audience. But a good PayPal integration goes far beyond dropping a "Pay with PayPal" button on your checkout page — it requires thoughtful architecture around payment flows, subscription management, webhook handling, and an optimised user experience. At SoniNow, we build PayPal integrations that are secure, reliable, and tailored to your specific business model.
Smart Buttons
PayPal Smart Buttons provide a modern, intelligent checkout experience that adapts to each buyer's preferred payment method — PayPal, Venmo, PayPal Credit, or debit/credit cards — in a single, embeddable interface.
Implementation Architecture
We integrate PayPal Smart Buttons into your web application using the PayPal JavaScript SDK. The integration renders a dynamic set of buttons that automatically display the most relevant payment options for each user based on their location, device, and past behaviour. Our implementation follows a three-step flow:
- Create Order — A server-side API call (using the PayPal Orders API v2) creates an order on PayPal's servers with the correct amount, currency, and item details.
- Capture Order — On the client side, the buyer approves the payment through the PayPal popup or redirect; the front end then calls your server, which executes
ordersCaptureto complete the transaction. - Fulfilment — On successful capture, your server fulfils the order (update database, send confirmation email, provision access) and redirects the buyer to a thank-you page.
Customisation and Branding
PayPal Smart Buttons are fully customisable — colour (gold, blue, silver, white, black), shape (pill, rect), layout (vertical, horizontal), label (checkout, pay, buynow, donate), and tagline visibility. We style them to match your brand while A/B testing different configurations for conversion rate. The buttons also support advanced credit and debit card processing in markets where PayPal processes cards directly, allowing buyers to pay without creating a PayPal account.
In-Checkout vs. Redirect Flow
We implement both embedded (in-context) and redirect flows. The embedded flow keeps buyers on your site during checkout, reducing abandonment. For environments with strict security requirements or popup blockers, we implement the server-side redirect flow that sends the buyer to PayPal and returns them via return URLs. Both flows are backed by the same server-side order management logic.
Express Checkout
PayPal Express Checkout enables a streamlined purchasing experience where buyers can complete their purchase in as few as two clicks, using their PayPal wallet's saved shipping address and payment method.
One-Touch Checkout
PayPal One Touch allows returning buyers to complete purchases without signing in to PayPal each time — a feature that significantly increases conversion rates. We implement this by requesting intent=CAPTURE or intent=AUTHORIZE with the correct context and ensuring your application handles payerID and paymentID correctly during the approval callback.
Order and Authorisation Management
Beyond simple captures, we implement advanced order management workflows:
- Authorize and Capture — For physical goods that ship later, we authorise the payment on checkout and capture it only when the order ships. This protects you from chargebacks on unshipped items while holding the funds.
- Partial Captures — For split shipments or multi-item orders fulfilled from different warehouses.
- Void and Refund — Full and partial refunds processed through the PayPal API, with automatic status updates in your system.
Dispute Resolution
PayPal's Dispute Resolution API enables programmatic handling of buyer disputes and chargebacks. We integrate dispute webhook notifications and, where applicable, automated refund logic within your business rules, reducing manual support overhead.
Subscriptions and Recurring Billing
Subscription revenue is the lifeblood of SaaS businesses, membership sites, and content platforms. PayPal's billing plans and agreements API provides a robust foundation for recurring payments.
Billing Plan Design
We design PayPal billing plans with flexible pricing structures:
- Fixed price — Monthly, quarterly, or annual plans at a set price
- Tiered pricing — Different plan levels with varying features and costs
- Trial periods — Free or discounted trial periods (7, 14, or 30 days) with automatic conversion to paid plans
- Custom amounts — Usage-based billing where the amount varies each cycle
Subscription Lifecycle Management
Our integration handles the full subscription lifecycle: creation (user opts in via the PayPal approval flow), activation (payment processed, access granted), billing (automatic recurring charges with retry logic for failed payments), upgrade/downgrade (prorated amount calculation and immediate effect or next-cycle effect), and cancellation (immediate or end-of-period with grace handling).
Billing Agreement Tokens
We store PayPal billing agreement IDs (BA-token) in your database linked to user accounts. On each billing cycle, PayPal sends an IPN (Instant Payment Notification) webhook, and we update subscription status accordingly. For failed payments, PayPal automatically retries up to three times before suspending the agreement.
Webhooks and Event-Driven Architecture
PayPal sends real-time webhook notifications for events like payment completion, dispute creation, subscription cancellation, and more. Proper webhook handling is essential for keeping your system synchronised with PayPal's state.
Webhook Configuration
We register webhook endpoints in your PayPal Developer Dashboard for event types relevant to your integration — PAYMENT.CAPTURE.COMPLETED, PAYMENT.CAPTURE.DENIED, CHECKOUT.ORDER.APPROVED, BILLING.SUBSCRIPTION.*, and customer dispute events. Each webhook payload is verified using PayPal's webhook signature verification (HMAC-SHA256) before processing.
Idempotency and Retry
Network issues between PayPal and your server can result in duplicate webhook deliveries. Our implementation uses idempotency keys and database-level transaction checks (e.g., SELECT ... FOR UPDATE on order ID) to ensure each event is processed exactly once. Failed webhook processing triggers an alert and queued retry.
Reconciliation
We build a daily reconciliation report that compares your system's payment records against PayPal's transaction history (retrieved via the PayPal Reporting API). Any discrepancies — missing payments, duplicate charges, unexpected refunds — are flagged for manual review.
Security and PCI Compliance
PayPal handles the complexity of PCI DSS compliance on your behalf — your integration never touches raw card numbers. However, we still implement security best practices:
- All API calls use OAuth 2.0 with client credentials (client ID + secret)
- Webhook verification ensures fake notification rejection
- IPN verification via
https://ipnpb.paypal.com/cgi-bin/webscrwithcmd=_notify-validate - HTTPS-only communication for all endpoints
- Regular secret rotation and credential storage in secrets management
Optimisation and Testing
PayPal's REST API includes a sandbox environment with test accounts that simulate various scenarios — successful payments, insufficient funds, declined authorisations, and refunds. We build comprehensive test suites that cover every flow before deploying to production.
From a simple donation button to a multi-plan subscription platform processing thousands of transactions daily, SoniNow delivers PayPal integrations that are robust, well-architected, and ready to scale.