The Order Refund integration allows you to upgrade your customers membership with an upsell. This is a built-in integration, you can set this up directly from the Integrations tab in the Product Settings.
How To Set Up A Order Refund Integration
Go to the Integrations tab in your Product Settings and select Order Refund from the services menu. Then select the product you want to refund when this product is purchased as an upsell.
Note, it is best to use only use this integration when the product is purchased as an upsell.
In the example below the following will occur from the settings chosen. When Product 2 is purchased as an upsell, Product 1 will be refunded immediately.
Note, the integration will only run once per order (e.g. if the order status is changed to pending later, then changed back to paid, the integration will not be triggered again as it was already triggered at checkout).