- Plugins and Extensions
- Magento 2
- WPG plugin for Magento 2
- Subscriptions and recurring payments
Subscriptions and recurring payments
You can use the plugin to configure different subscription plans (weekly/monthly/quarterly, etc) at a product level. Your shoppers can then place orders by subscribing to the associated payment plans.
How to configure subscription and payment plans
Prerequisite: Ask Worldpay to activate recurring payments on your merchant code.
To configure subscriptions:
Go to Stores/Configuration/Sales/Worldpay/Subscription Settings and set Subscriptions Enabled to Yes. The Subscription Settings screen appears:
Go to Catalog/Products. Open a product and expand the Subscriptions section:
Use the information in the table to set the Subscription options for this product.
|Enabled||If set to Yes, subscription is enabled at product level.|
|Allow Selectable Start Date||If set to Yes, the shopper can set a start date for the subscription to begin.|
|Add Payment Plan||Click to add payment plans for the shopper to subscribe to.|
Click Add Payment Plan to create a payment plan the shopper can subscribe to:
|Active||If set to Yes, the subscription is enabled at product level.|
|Code||The code retains the payment plan’s uniqueness. If the code entered is a monthly plan then the final sample code is Product ID_monthly-plan to maintain uniqueness.|
|Description||An optional field to describe the payment plan.|
|Recurring Cycle||Select a cycle (weekly / monthly / quarterly / semiannually / annually). Future orders and payment capture are executed based on the cycle.|
|Recurring Amount||The recurring amount overrides the product price if the shopper opts for subscriptions.|
|Website||This payment plan is applicable to the whole website. (Default option.)|
After you create the payment plan, the plan appears in the Subscription section. To change the order of payment plans, use Magento's drag-and-drop feature.
On the product-detail page, the shopper can select a payment plan. If the shopper selects Add a Payment Plan, all the active payment plans created under How to configure subscription and payment plans appear.
The product price is updated based on the selected plan and the shopper can set the subscription start date if this is enabled. The shopper can then complete the subscription after adding the product to their cart.
The shopper can see their subscription orders in My Account/My Subscriptions, where they can edit or cancel subscriptions and update their address.
When a subscription order is placed using stored credentials/tokenization, all future orders and transactions related to that subscription are handled as recurring orders.
Shoppers cannot place a subscription order unless they select the Save Your Card option. This prompts Worldpay to create an authorization token. Magento saves this token for future recurring orders.
To set up recurring orders:
- You must set up the cron job worldpay_recurring_transactions to run every 24 hours.
This cron job checks all the subscriptions whose start date or next order date are queued over the next five days. The job creates recurring orders for all the subscriptions.
Once Magento creates a recurring order, its sends an authorization request to Worldpay and, if successful, follow-up capture requests are triggered. After successful capturing/invoicing, recurring orders are fulfilled.