How extension works?

Installation



You will require to install MageDelight Base Extension first. If it is not installed then please download it from https://www.magedelight.com/pub/extensions/magedelight-base.zip and unzip the package file into the root folder of your Magento 2 installation.


Before installing the extension, please make sure to Backup your web directory and store database


You will require to install MageDelight Base Extension first. If it is not installed then please download it from https://www.magedelight.com/pub/extensions/magedelight-base.zip and unzip the package file into the root folder of your Magento 2 installation.

Root Directory is - "app/code/magedelight/#YourExtensionName#"

  • Unzip the extension package file into the root folder of your Magento 2 installation.
  • Connect to SSH console of your server:
    • Navigate to the root folder of your Magento 2 setup
    • Run command as per below sequence,

      php bin/magento setup:upgrade

      php bin/magento setup:di:compile

      php bin/magento setup:static-content:deploy

      php bin/magento cache:clean

  • log out from the backend and log in again


If you are using Magento 2.3 or later then you do not need to activate license. Extension will be activated with silent activation mechanism and does not require activation keys to be entered manually.   


Backend Configuration (Admin side)


Once you install and setup extension license key (refer extension installation guide). You need to configure extension and setting it up as per your business needs. Below are extension configuration options,

  • Enable Subscription: Option to disable/enable subscribe now extension feature.
  • Manage Subscription Interval: Admin can create different subscription interval. This would be the combination of interval type and number of interval and set Interval label for each interval offset.
    • Interval type: Day, Week, Month, and Year.
    • Number of interval: Numeric positive integer values.
    • Interval Label: Admin can give interval label with regional language i.e. Interval type could be = Month, Number of interval = 1 label could be Every Month/Once in month
  • Maximum Payment Failed: It can hold numeric positive integer values. To define maximum payment failure allowed to customer. Hence, if the recurring order gets failed, order wouldn’t be place but subscription profile would be continued. On next occurrence script will try to place order for customer, till the maximum payment failure allowed. After maximum failure over, the recurring profile will get suspended.
    If maximum payment failure is set to zero (0), subscription profile get suspended at the first time of failure.
  • Select Payment Gateway: You can select the payment gateway you like to us for subscription. It would allow only single payment gateway for subscription.
  • Allow To Update Billing Frequency : If set yes, the user will be updating the billing cycle(s) from their subscription(s). The next occurrence cycle will be count from the day of billing frequency updated.
  • Update Next Occurrence Date On Frequency Update : If set yes, the subscription occurrence date will be updated with newly settled billing frequency at the same time. If you set No, Next occurrence date won't update until to the next cycle
  • Select Shipping Method: select shipping methods allowed for order with subscription product or subscription plan.
  • Allowed To Update Billing Address: You can give controls to customer, if customer can update their billing address of not.
  • Allowed To Update Shipping Address: You can give controls to customer, if customer can update their shipping address of not.
  • Allowed To Update Profile Before: This field can have positive integer value only. This defines number of days before next occurrence customer can edit their subscription profile.

    Please note that : Pause ,Cancel ,Edit Subscription Button would get disabled in such scenario : If customer have daily recurring cycle of product and admin have set allowed To Update Profile Before is set to 5 days then it will never satisfy the condition to show the buttons.

  • Dynamic Price: Enable to place subscription order with product's current price. You can disable to keep price of product at the time of subscription started.
  • Send Reminder Of Occurrence Before: Next occurrence reminder email would be send before number of days defined here. It should be greater than allowed to update profile before value.
  • Send E-Wallet Topup Reminder Before: Define days to send e-wallet topup reminder email
  • CRON JOB Frequency: Define CRON Frequency to generate orders for subscription profiles. Values could be daily, weekly, monthly. Daily is the suggested option.
  • CRON JOB Start Time: Define CRON Start Time to generate orders for subscription profiles.

  • Allowed Maximum Quantity to Subscribe per Product: You can set limit on subscribing product quantity per.
  • Enable Summary block on cart page: Admin can define to show summary block on cart page or not.
  • Subscription Product List Page Text: Text to be shown on product listing page, to identify/show product is available for subscription from product listing page.
  • Header Summary Text: Header text on summary block on cart page.
  • Summary Text: Summary content text for subscription summary block on cart page.
  • Free Shipping for Subscription: If set yes, will free shipping for all recurring orders and ignore shipping cost for the shipping method selected.
  • Allow to Skip Subscription: You can give controls to customer, if customer can skip product subscription.
  • Allow To Pause Subscription: You can give controls to customer, if customer can pause product subscription.
  • Allow to Cancel Subscription: You can give controls to customer, if customer can cancel product subscription.


  • Send New Subscription Email? : Option to disable/enable new Subscription orders details email send to customers. 
  • Send Subscription Update Email? : Option to disable/enable Subscription order update emails send to customers.
  • Send Payment Failed Email? : Option to disable/enable payment failure emails send to customers.
  • Send Subscription Reminder Email? : Option to disable/enable Subscription reminder emails send to customers.
  • Send E-Wallet Topup Reminder? : Option to disable/enable E-Wallet Topup Reminder emails send to customers.
  • Send Subscription Renew Email? : Option to disable/enable Subscription order renewal emails send to customers.
  • Send Subscription Order Email?  : Option to disable/enable new Subscription orders emails send to customers. If set yes , Customer would receive the email of particular subscription profile order.



Other option is Product Subscription Email Configuration that would allow you to manage email sender, email template and email address to send email copy for respective emails.

Backend Functionality


Manage Subscription Products

  • Enable Subscribe Now: Is product enable for subscription. Admin can enable product and configure product option for particular product.
  • Product Purchase Option: If product is enable for subscription, you can set product can be subscribe only. Else it could be ether subscription or one time purchase only.
  • Discount Type: You can offer discount on product subscription. Discount could be with Percentage or fixed on product price.
  • Discount on Subscription: With previous option if discount type is fixed, you can defined discount amount on product price. Else if type if percentage, you can set percentage from 0 to 100% of price.
  • Initial Fee: Some time you may need to have initial fee on subscribing any product to setup/configure subscription product, which you can set here. This is one time charge, applicable on product subscription.
  • Billing Period Defined by: Admin or Customer. This defines that who can decide/define the billing period. If option is set to customer, customer would get selection of billing period on product page. Customer can choose the billing frequency could be weekly, monthly, etc. as defined by admin. If set to admin, you can fix the billing period for customer.
  • Billing Period: This option will only available if with previous option value is set to admin. You would have billing period selection, recurring order will be generated on predefined period only.
  • Number of Billing Cycle: It defines the number time recurring order should be generated. If you put this blank, subscription will be unlimited, until the subscription failed or cancelled.
  • Subscription Start From: This could be one of below option,
    • Moment of purchase – Subscription will be started at the time to subscription/order placed.
    • Defined By Customer – On product page, customer will get calendar to select subscription service start date. On that particular date first order will get generated.
    • Last date of Month – Last date of month will be considered as subscription start date.
    • Exact Day of Month – For this option, you will have to define particular number of day (i.e. 1, 13, etc.…) with next option “Day of Month”.
  • Allow subscribes to update next subscription date: This is to give control to your customer to manage their next subscription date. If you have set this option to yes, subscribers can update next subscription dates if needed.

  • Trial Billing Period: If you need to provide trial period for particular product you can enabled this option.

Manage Product Subscribers

You will have full control over the product subscribers. You can manage product scriber from Admin >> MageDelight >> Subscribe Now >> Subscriptions

As shown with above image you can find all subscriber lists with all basic information. I.e. customer details, product name, Subscription status, etc.

Manage Product Subscription

You can view the product subscription details with all require information likewise frontend. You can view all details with subscribed product, payment details, and subscription details. Also, you can manage shipping and billing address as well.

Edit Product Subscription Profile

You will have full control to manage subscription profile for customer. You can also prevent your customer to edit and modify subscription them self and instead that you can hold power to manage profiles on behalf of your customer. You can cancel, pause, and skip subscription. You can edit profile for customer, too.

With edit profile you can update, subscription product quantity, changes selected credit card, billing and shipping address.

Frontend Functionality


Product Listing Page

Once the products are set with subscription options, products are available at frontend to subscribe. If product is available for subscription, you can set text to show customer that product subscription option is available on product listing page.

Product Details Page

There could be different option available for subscription based on product configured at backend. Below are some of examples,

Subscribe only:

  • This product is available for subscription only. Don’t have option for one time purchase.
  • It also offers trial period for 2 time delivery with discounted rate of 10
  • Subscription start date is 21st  of every month
  • Subscription is unlimited until customers cancel the subscription

One time purchase Or Subscription:

  • Customer can choose to purchase for one time or subscribe product for regular delivery
  • Admin can offer discount on subscribing product to force customer to subscribe product and set repeat business for long time
  • Subscription discount is 3.50 USD
  • Subscription period is 12 months, so every month 12 times recurring order will occur
  • Customers have option to start subscription, so the first shipping would be generated on selected date

Customer can define subscription period:

  • Again, this product is available with both option to have subscription or one time delivery
  • Customer can choose subscription period from the list. Customer has choice on what frequency he/she live get delivery of product based on product consumption/uses
  • Product subscription is unlimited period until customers cancel product subscription

Shopping cart

Subscription option would be shown as product custom option on cart page. So, the regular product and subscription product on same cart can be differentiated. As shown with above image

Pay using eWallet

eWallet can be used as a payment method. Buyer can load money to their eWallet and amount will be deducted from wallet balance. If buyer doesn’t have equal amount of balance as order total then, buyer’s available balance will be deducted and remaining amount will be collected from credit/debit card.

REST API


Please use SWAGGER to get detailed information of parameters. Your URL looks like, i.e. rest/v1/subscriptions

https://subscribenow.m2.demo.magedelight.com/swagger

Customer Balance

/ewallet/customer

Sample Data: {
"wallet":"",
"customer":"2"
}

Get Subscription Details

/subscription/{subscriptionId}

Please use searchCriteria params to retrieve records.

Create Subscriptions

/subscription/create

Sample Data

{
"productSubscribers": {
"profile_id": "API_1",
"customer_id": "2",
"product_id": "1",
"subscriber_name": "John Doe",
"subscriber_email": "sample@magedelight.com",
"store_id": "1",
"payment_method_code": "cashondelivery",
"subscription_start_date": "2019-05-10",
"billing_period_label": "Daily",
"billing_period": "1",
"billing_frequency": "2",
"period_max_cycles": "5",
"billing_amount": "50",
"trial_period_label": null,
"trial_period_unit": null,
"trial_period_frequency": 0,
"trial_period_max_cycles": 0,
"trial_billing_amount": null,
"currency_code": "USD",
"shipping_amount": "2",
"tax_amount": "2",
"initial_amount": "2",
"discount_amount": "12",
"order_item_info": {
"options": {
"_1": "subscription"
},
"subscription_start_date": "2019-05-10",
"qty": "1"
},
"additional_info": {
"product_sku": "24-MB01",
"shipping_title": "Flat Rate - Fixed"
},
"subscription_status": "1",
"next_occurrence_date": "2019-05-12",
"last_bill_date": "2019-05-10",
"payment_token": "",
"base_currency_code": "USD",
"base_billing_amount": "39",
"base_trial_billing_amount": "3",
"base_shipping_amount": "2",
"base_tax_amount": "1",
"base_initial_amount": "2",
"base_discount_amount": "12",
"billing_address_id": "1",
"shipping_address_id": "1",
"is_trial": "0",
"shipping_method_code": "flatrate_flatrate",
"product_name": "joust",
"payment_title": "Cash on delivery"
}
}

Create Subscription from Order

/subscription/create-by-order/{orderId}

Skip Subscription

/subscription/skip

Pause Subscription

/subscription/pause

Resume Subscription

/subscription/resume

Cancel Subscription

/subscription/cancel

Update Subscription

/subscription/update

Sample Data

{
"subscriptionId": 101,
"modifiedby": 0,
"subscription": {
"qty": "1",
"subscription_start_date": "2019-12-25",
"md_savecard": "paymentToken",
"md_billing_address": "1",
"md_shipping_address": "1"
}
}

Product Details Page

You will get subscription details from Magento's default product API /products/{sku} get subscription data from "custom_attributes" node.

While posting data, you have to pass below subscription parameters from product details page,

  • Subscription Product Type: options[_1] with value "nosubscription" or "subscription"
  • billing_period
  • subscription_start_date

GraphQL

Get Subscriptions

Request

{
  getSubscriptions(subscriptionId: 1) {
    subscription_id
    profile_id
    customer_id
    product_id
    product_sku
    subscriber_name
    subscriber_email
    store_id
    payment_method_code
    subscription_start_date
    suspension_threshold
    billing_period_label
    billing_period
    billing_frequency
    period_max_cycles
    billing_amount
    trial_period_label
    trial_period_unit
    trial_period_frequency
    trial_period_max_cycles
    trial_billing_amount
    currency_code
    shipping_amount
    tax_amount
    initial_amount
    discount_amount
    subscription_status
    subscription_item_info
    created_at
    updated_at
    next_occurrence_date
    last_bill_date
    trial_count
    payment_token
    total_bill_count
    base_currency_code
    base_billing_amount
    base_trial_billing_amount
    base_shipping_amount
    base_tax_amount
    base_initial_amount
    base_discount_amount
    initial_order_id
    billing_address_id
    shipping_address_id
    is_trial
    shipping_method_code
    product_name
    payment_title
    billing_frequency_cycle
    is_update_billing_frequency
    order_item_info
    additional_info
    order_info
  }
}

Response

{
    "data": {
        "getSubscriptions": {
            "subscription_id": 1,
            "profile_id": 100000001,
            "customer_id": 1,
            "product_id": 2041,
            "product_sku": "KT Channel Subscription",
            "subscriber_name": "Veronica Costello",
            "subscriber_email": "roni_cost@example.com",
            "store_id": 1,
            "payment_method_code": "adyen_cc",
            "subscription_start_date": "2022-04-22 11:09:30",
            "suspension_threshold": 0,
            "billing_period_label": "15 Days",
            "billing_period": 1,
            "billing_frequency": 15,
            "period_max_cycles": 50,
            "billing_amount": 1490,
            "trial_period_label": "",
            "trial_period_unit": "0",
            "trial_period_frequency": 0,
            "trial_period_max_cycles": null,
            "trial_billing_amount": "0.0000",
            "currency_code": "USD",
            "shipping_amount": "5.0000",
            "tax_amount": "98.3400",
            "initial_amount": "100.0000",
            "discount_amount": "10.0000",
            "subscription_status": "1",
            "subscription_item_info": "[]",
            "created_at": "2022-04-22 11:09:30",
            "updated_at": "2022-04-22 11:09:30",
            "next_occurrence_date": "2022-05-07 11:09:30",
            "last_bill_date": "2022-04-22 11:09:30",
            "trial_count": 0,
            "payment_token": "0:3:jQuL+UX1Ptf",
            "total_bill_count": 1,
            "base_currency_code": "USD",
            "base_billing_amount": "1490.0000",
            "base_trial_billing_amount": "0.0000",
            "base_shipping_amount": "5.0000",
            "base_tax_amount": "98.3400",
            "base_initial_amount": "100.0000",
            "base_discount_amount": "10.0000",
            "initial_order_id": "000000004",
            "billing_address_id": "1",
            "shipping_address_id": "1",
            "is_trial": "0",
            "shipping_method_code": "flatrate_flatrate",
            "product_name": "KT Channel Subscription",
            "payment_title": "Credit Card",
            "billing_frequency_cycle": "_1650610816454_454",
            "is_update_billing_frequency": "0",
            "order_item_info": "{\"uenc\":\"aHR0cDovL21hZ2VudGcuaHRtbA,,\",\"product\":\"2041\",\"qty\":1,\"options\":{\"_1\":\"subscription\"},\"subscription_start_date\":\"2022-04-22\",\"original_qty\":1}",
            "additional_info": "{\"shipping_title\":\"Flat Rate - Fixed\",\"product_options\":[]}",
            "order_info": "[]"
        }
    }
}

Get Subscriptions By Customer ID

Request

{
  getSubscriptionsByCustomerId(
    currentPage: 1
    pageSize: 1
  ){
    total_count
    items{
      subscription_id
    profile_id
    customer_id
    product_id
    product_sku
    subscriber_name
    subscriber_email
    store_id
    payment_method_code
    subscription_start_date
    suspension_threshold
    billing_period_label
    billing_period
    billing_frequency
    period_max_cycles
    billing_amount
    trial_period_label
    trial_period_unit
    trial_period_frequency
    trial_period_max_cycles
    trial_billing_amount
    currency_code
    shipping_amount
    tax_amount
    initial_amount
    discount_amount
    subscription_status
    subscription_item_info
    created_at
    updated_at
    next_occurrence_date
    last_bill_date
    trial_count
    payment_token
    total_bill_count
    base_currency_code
    base_billing_amount
    base_trial_billing_amount
    base_shipping_amount
    base_tax_amount
    base_initial_amount
    base_discount_amount
    initial_order_id
    billing_address_id
    shipping_address_id
    is_trial
    shipping_method_code
    product_name
    payment_title
    billing_frequency_cycle
    is_update_billing_frequency
    order_item_info
    additional_info
    order_info
    }
  }
}

Response

{
  "data": {
    "getSubscriptionsByCustomerId": {
      "total_count": 2,
      "items": [
        {
          "subscription_id": 1,
          "profile_id": 100000001,
          "customer_id": 1,
          "product_id": 2041,
          "product_sku": "KT Channel Subscription",
          "subscriber_name": "Veronica Costello",
          "subscriber_email": "roni_cost@example.com",
          "store_id": 1,
          "payment_method_code": "adyen_cc",
          "subscription_start_date": "2022-04-22 11:09:30",
          "suspension_threshold": 0,
          "billing_period_label": "15 Days",
          "billing_period": 1,
          "billing_frequency": 15,
          "period_max_cycles": 50,
          "billing_amount": 1490,
          "trial_period_label": "",
          "trial_period_unit": "0",
          "trial_period_frequency": 0,
          "trial_period_max_cycles": null,
          "trial_billing_amount": "0.0000",
          "currency_code": "USD",
          "shipping_amount": "5.0000",
          "tax_amount": "98.3400",
          "initial_amount": "100.0000",
          "discount_amount": "10.0000",
          "subscription_status": "1",
          "subscription_item_info": "null",
          "created_at": "2022-04-22 11:09:30",
          "updated_at": "2022-04-22 11:09:30",
          "next_occurrence_date": "2022-05-07 11:09:30",
          "last_bill_date": "2022-04-22 11:09:30",
          "trial_count": 0,
          "payment_token": "0:3:jQuL+UX1PtfGVxscLFAeyatIJb4WE=",
          "total_bill_count": 1,
          "base_currency_code": "USD",
          "base_billing_amount": "1490.0000",
          "base_trial_billing_amount": "0.0000",
          "base_shipping_amount": "5.0000",
          "base_tax_amount": "98.3400",
          "base_initial_amount": "100.0000",
          "base_discount_amount": "10.0000",
          "initial_order_id": "000000004",
          "billing_address_id": "1",
          "shipping_address_id": "1",
          "is_trial": "0",
          "shipping_method_code": "flatrate_flatrate",
          "product_name": "KT Channel Subscription",
          "payment_title": "Credit Card",
          "billing_frequency_cycle": "_1650610816454_454",
          "is_update_billing_frequency": "0",
          "order_item_info": "{\"uenc\":\"aHR0cDovL21hZ2HRtbA,,\",\"product\":\"2041\",\"qty\":1,\"options\":{\"_1\":\"subscription\"},\"subscription_start_date\":\"2022-04-22\",\"original_qty\":1}",
          "additional_info": "{\"shipping_title\":\"Flat Rate - Fixed\",\"product_options\":[]}",
          "order_info": "null"
        }
      ]
    }
  }
}

Pause Subscription

Request

mutation {
  pauseSubscription(
    subscriptionId: 1
  ) {
    success
    message
  }
}

Response

{
  "data": {
    "pauseSubscription": {
      "success": true,
      "message": "Subscription successfully paused"
    }
  }
}

Migration Steps


Subscribe now v. 100.x.x is now deprecated and we have launched new upgraded version v.200.x.x hence we do not provide support for deprecated versions.

Step 1: Take a full backup of your site with database

Step 2: Remove/Delete old Subscribe Now extension source code (i.e. app/code/Magedelight/Subscribenow).

Step 3: Extract new Subscribe Now extension to the same directory where you were having older one (i.e. app/code/Magedelight/Subscribenow).

Step 4: Run below commands,


php -f bin/magento setup:upgrade
php -f bin/magento setup:di:compile
php -f bin/magento setup:static-content:deploy

Step 5: Run migration command to make your old extension version compatible with our new extension version,


php bin/magento md:subscribenow:upgrade

Demo


Click here to visit frontend.

Click here to visit backend admin panel.

FAQs


Click here to visit FAQs.

Support


Click here to raise a support ticket using your MageDelight account.

Additional Services


Click here to get the customized solution for this extension.



Thank you for choosing MageDelight!



  • No labels