Post-Purchase Upsell

PayPal setup

This section only matters if you want upsells on PayPal-paid orders. The other payment methods (invoice, prepayment, cash on delivery, direct debit) need none of it.

Post-Purchase Upsell does not connect to PayPal itself. It rides on top of the official SwagPayPal extension and uses the PayPal account, credentials and saved-payment tokens that SwagPayPal manages. So “configuring PayPal” here means configuring SwagPayPal and your PayPal account; this plugin then uses what is already there. Tested with SwagPayPal 10.x on Shopware 6.7.

What belongs to whom

The vaulting, sandbox/live and Reference Transactions steps below are PayPal-account and SwagPayPal settings, not part of this plugin. Follow SwagPayPal's and PayPal's own documentation for the exact screens; the steps here are an orientation. This plugin's part is only: use the saved-payment token SwagPayPal provides to charge the add-on, and, when there is no saved token, offer a one-time second approval if you enabled that setting.

The two ways a PayPal add-on is collected

Silent vault re-charge (best): the add-on is charged in the background; the customer just sees the item added, with no second PayPal step. It needs PayPal vaulting enabled, a registered customer with a saved PayPal payment, and (live only) Reference Transactions enabled on your PayPal account.

Second approval (fallback): the customer is sent to PayPal once more to approve just the add-on amount, then returns and the item is added. It needs the plugin setting PayPal: collect upsell via a second approval turned on. Used for a PayPal customer who has no saved (vaulted) payment.

Keep the second approval setting on (it ships on) as your safety net: a customer without a saved token can then be offered the one-time approval, while the silent re-charge is used automatically whenever a saved token is available.

Step 1: Enable PayPal vaulting in SwagPayPal

Vaulting lets a registered customer save their PayPal account so the add-on can be charged again without sending them back to PayPal.

  1. Open PayPal under Settings (or Settings → Extensions → My extensions → PayPal → Configure).
  2. Find the Vaulting option (“Allow customers to save their PayPal account…”) and turn it on. Save.
  3. Good to know:
    • Vaulting saves a token for a customer who agrees to save their PayPal during checkout. A customer without a saved token takes the second-approval path instead (this is handled by SwagPayPal; typically a guest or first-time PayPal buyer has no saved token).
    • A customer's payment is saved when they pay; the silent re-charge is then available for the add-on on that order and their future orders.

Step 2: Test in sandbox first

Sandbox is PayPal's safe test environment, no real money moves. Reference Transactions are available automatically in sandbox, so the silent re-charge works there with no extra request.

  1. At developer.paypal.com→ Testing Tools → Sandbox Accounts, make sure you have a Business (merchant) and a Personal (buyer) test account.
  2. In SwagPayPal, turn Sandbox mode on and enter your sandbox REST API credentials (or use “Connect with PayPal” onboarding while in sandbox).
  3. Enable Vaulting (Step 1) while in sandbox.
  4. Run the full flow in your storefront: register and log in (not guest), buy a product, choose PayPal, approve as your sandbox buyer agreeing to save the payment. On the offer page, click add and confirm the item is added and the order shows a separate PayPal transaction for the add-on.

Step 3: Go live

  1. In SwagPayPal, turn Sandbox off and connect your live PayPal Business account. Sandbox and live settings are stored separately.
  2. Re-check Vaulting is enabled in the live configuration: turning it on in sandbox does not turn it on for live.
  3. Enable Reference Transactions on your live PayPal account. This is the step that is easy to miss. The silent re-charge is a merchant-initiated charge, which a live PayPal Business account may only make when Reference Transactions (also called merchant-initiated transactions or billing agreements) is enabled: this is a PayPal-account requirement, requested from PayPal. Until it is active, the silent re-charge for a vaulted customer will be declined and the add-on will not be added (there is no second-approval fallback for an already-vaulted customer). So enabling Reference Transactions is what makes the silent re-charge work live.
  4. Do one small real-money test: as a registered customer, place a low-value live PayPal order, accept the upsell, confirm the add-on is captured, then refund it from the order's PayPal tab.
Real-money test before relying on silent upsells

Do not rely on sandbox success alone. Reference Transactions are automatic in sandbox but must be enabled separately for live, so a silent re-charge that worked in sandbox can be declined live. Before relying on silent PayPal upsells, run one small real live order, confirm the add-on was actually captured, and then refund it.

Quick checklist

  • SwagPayPal installed and connected: sandbox (sandbox credentials), live (live credentials).
  • Sandbox mode in SwagPayPal: sandbox on, live off.
  • Vaulting enabled: sandbox yes, live yes (set separately).
  • Reference Transactions on the account: sandbox automatic, live request it from PayPal.
  • Plugin second approval setting: sandbox and live on (safety net).
  • Verified with a real flow: sandbox with a test-buyer order, then accept; live with one small real-money order, then refund.

If the PayPal upsell does not behave

  • Always asks for a second approval (never silent): the customer has no saved (vaulted) payment yet (for example a first-time PayPal buyer), or vaulting is off in SwagPayPal.
  • Add-on not added for PayPal customers without a saved payment: the second approval setting is off, turn it on.
  • Silent charge worked in sandbox but is declined live (and the add-on is not added): almost always Reference Transactions is not yet enabled on your live PayPal account (Step 3, point 3).