make_post_sell/docs/PAYPAL.md

1.5 KiB

PayPal Payments

PayPal is available as a payment method alongside Stripe and crypto (XMR/DOGE).

Shop Setup

  1. Go to https://developer.paypal.com/dashboard/
  2. Create an app (sandbox for testing, live for production)
  3. Copy Client ID and Secret
  4. In Shop Settings → PayPal Settings, enter credentials and save

Configuration

Global settings in development.ini:

app.payments.paypal.enabled = True
app.paypal.sandbox_mode = True

Or environment variables:

export MPS_PAYMENTS_PAYPAL_ENABLED=True
export MPS_PAYPAL_SANDBOX_MODE=True

How It Works

  • Each shop configures their own PayPal credentials
  • PayPal button appears at checkout when enabled
  • Payment info stored on Invoice (paypal_order_id, paypal_capture_id)
  • Invoice.payment_method returns "paypal" for PayPal payments
  • Saved payment methods stored in PayPalUserShop

Code

  • make_post_sell/views/cart.py - PayPal checkout functions (paypal_create_order, paypal_complete_checkout)
  • make_post_sell/views/billing.py - Disconnect saved PayPal
  • make_post_sell/views/paypal_webhooks.py - Webhook handler

Database

mps_shop columns:

  • paypal_client_id - Shop's PayPal Client ID
  • paypal_secret - Shop's PayPal Secret
  • paypal_enabled - Toggle PayPal on/off

mps_invoice columns:

  • paypal_order_id - PayPal order reference
  • paypal_capture_id - PayPal capture reference

mps_paypal_user_shop table:

  • Tracks saved PayPal payment methods per user/shop