Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section

Frontend Functionality


Product Listing Page

Panel

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,

Panel

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
Panel

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
Panel

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

Panel

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

Panel

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.


Section

REST API


Note

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


Panel

Customer Balance

Panel

/ewallet/customer

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

Get Subscription Details

Panel

/subscription/{subscriptionId}


Note

Please use searchCriteria params to retrieve records.

Create Subscriptions

Panel

/subscription/create

Sample Data

Expand
{
"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

Panel

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

Skip Subscription

Panel

/subscription/skip

Pause Subscription

Panel

/subscription/pause

Resume Subscription

Panel

/subscription/resume

Cancel Subscription

Panel

/subscription/cancel

Update Subscription

Panel

/subscription/update

Sample Data

Expand
{
"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

Panel

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



Section

GraphQL

getSubscriptions


panel
Panelpanel

Get Subscriptions 

Request

Expand

{
  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

Sample 

Expand

{
    "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": "[]"
        }
    }
}



...