承接 reachweb/resrv-payment-paypal 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

reachweb/resrv-payment-paypal

Composer 安装命令:

composer require reachweb/resrv-payment-paypal

包简介

PayPal payment gateway for Statamic Resrv

README 文档

README

PayPal payment gateway add-on for Statamic Resrv.

Features

  • PayPal Wallet Payments - Users can pay with their PayPal account
  • Direct Card Payments - Credit/debit card fields rendered directly on your checkout page (Advanced Credit and Debit Card Payments)
  • No Redirects - Payment handled inline via PayPal JavaScript SDK
  • Secure - PCI-compliant hosted card fields, webhook signature verification

Requirements

  • PHP 8.2+
  • Laravel 11.x
  • Statamic 5.x
  • Statamic Resrv 5.x
  • PayPal Business Account with Advanced Credit and Debit Card Payments enabled (for card fields)

Installation

composer require reachweb/resrv-payment-paypal

Optionally publish the configuration:

php artisan vendor:publish --tag=resrv-paypal-config

PayPal Account Setup

  1. Go to the PayPal Developer Dashboard
  2. Create a new application (or use an existing one)
  3. Note your Client ID and Client Secret for both sandbox and live environments
  4. Enable Advanced Credit and Debit Card Payments in your app settings to allow direct card input

Tip: Advanced Credit and Debit Card Payments (ACDC) is automatically enabled for sandbox accounts. For live accounts, you may need to request access through your PayPal account manager.

API Configuration

Add your PayPal credentials to your .env file:

PAYPAL_CLIENT_ID=your_client_id
PAYPAL_CLIENT_SECRET=your_client_secret
PAYPAL_MODE=sandbox
PAYPAL_WEBHOOK_ID=your_webhook_id

Set PAYPAL_MODE to sandbox for testing or live for production.

Important: For security purposes, never commit your API credentials to version control. Always use environment variables.

If you have configuration caching enabled, clear it after updating your .env file:

php artisan config:clear

Webhook Configuration (Required)

Webhooks are mandatory for the PayPal payment gateway. They ensure payment confirmations are received even if a customer closes their browser before returning to your site.

Setting up Webhooks

  1. In your PayPal Developer Dashboard, go to your application settings
  2. Navigate to Webhooks and click Add Webhook
  3. Enter your webhook URL: https://yoursite.com/resrv/api/webhook
  4. Subscribe to these events:
    • PAYMENT.CAPTURE.COMPLETED
    • PAYMENT.CAPTURE.DENIED
    • PAYMENT.CAPTURE.REFUNDED
  5. Save the webhook and copy the Webhook ID
  6. Add the Webhook ID to your .env file:
PAYPAL_WEBHOOK_ID=your_webhook_id

Warning: Without a valid PAYPAL_WEBHOOK_ID, webhook signature verification will fail and payment confirmations will be rejected with a 403 error.

Webhook Signature Verification

The gateway uses PayPal's verify-webhook-signature API to validate all incoming webhook notifications. This ensures:

  • Webhooks actually come from PayPal
  • The payload hasn't been tampered with
  • Your application is protected from spoofing attacks

Payment Gateway Configuration

Update your config/resrv-config.php file to use the PayPal payment gateway:

'payment_gateway' => Reach\ResrvPaymentPaypal\Http\Payment\PaypalPaymentGateway::class,

Payment Flow

This gateway uses the PayPal JavaScript SDK for an inline payment experience. When a customer completes a reservation:

  1. The checkout page displays PayPal buttons and card fields inline
  2. Customer can either:
    • Click the PayPal button to pay via PayPal wallet (opens popup)
    • Enter card details directly in the card fields on your page
  3. Payment is captured via your server
  4. Customer is redirected to the checkout completion page
  5. PayPal sends a webhook notification
  6. The webhook signature is verified
  7. The reservation is confirmed

Payment Options Displayed

  • PayPal Button - Opens PayPal popup for wallet payments, Pay Later, Venmo (US)
  • Card Fields - Direct card number, expiry, CVV, and cardholder name input (requires ACDC enabled)

If Advanced Credit and Debit Card Payments is not enabled for your account, only the PayPal button will be displayed.

Customizing the Payment View

The package provides a default checkout payment view. To customize the styling or layout:

php artisan vendor:publish --tag=resrv-paypal-views

This publishes the view to resources/views/vendor/statamic-resrv/livewire/checkout-payment.blade.php.

You can customize:

  • Button colors and styles
  • Card field container styling
  • Labels and translations
  • Layout and spacing

Going Live

Before accepting live payments:

  1. Test thoroughly in sandbox mode with PayPal sandbox accounts
  2. Create a live webhook in your PayPal application with the same events
  3. Ensure Advanced Credit and Debit Card Payments is enabled for your live app
  4. Update your .env file with live credentials:
PAYPAL_CLIENT_ID=your_live_client_id
PAYPAL_CLIENT_SECRET=your_live_client_secret
PAYPAL_MODE=live
PAYPAL_WEBHOOK_ID=your_live_webhook_id
  1. Clear the configuration cache:
php artisan config:clear

Supported Currencies

Ensure your Resrv currency configuration (resrv-config.currency_isoCode) uses a PayPal-supported currency.

Troubleshooting

Card fields not appearing

If only the PayPal button appears without card fields:

  • Verify Advanced Credit and Debit Card Payments (ACDC) is enabled in your PayPal app settings
  • Check browser console for JavaScript errors
  • Ensure your PayPal Client ID is correct

Payments not being captured

Ensure that:

  • Your PayPal API credentials are correct
  • The PAYPAL_MODE matches your credential type (sandbox/live)
  • Your server can make outbound HTTPS requests to PayPal's API

Webhook returns 403 error

This indicates webhook signature verification failed. Check that:

  • PAYPAL_WEBHOOK_ID is correctly set in your .env file
  • The webhook ID matches the webhook configured in your PayPal application
  • Your server time is synchronized (significant time drift can cause verification failures)

Webhook notifications not received

Verify that:

  • Your webhook URL is publicly accessible
  • Your server is not blocking PayPal's IP addresses
  • The webhook is enabled in your PayPal Developer Dashboard
  • You've subscribed to the correct events

"PayPal webhook ID is not configured" error

You must set the PAYPAL_WEBHOOK_ID environment variable. Webhooks are mandatory for this payment gateway to function properly.

JavaScript SDK fails to load

If you see "Failed to load PayPal SDK" error:

  • Check browser console for specific error messages
  • Verify your PAYPAL_CLIENT_ID is correct
  • Ensure your domain is not blocked by PayPal
  • Check for Content Security Policy issues

License

MIT License. See LICENSE for details.

reachweb/resrv-payment-paypal 适用场景与选型建议

reachweb/resrv-payment-paypal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「paypal」 「statamic」 「Resrv」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 reachweb/resrv-payment-paypal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 reachweb/resrv-payment-paypal 我们能提供哪些服务?
定制开发 / 二次开发

基于 reachweb/resrv-payment-paypal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-21