Skip to main content

Integrate Recurpay with your Mobile App using Shopify checkout

Updated over a month ago

Well, if you are running with the pace of this digital world, you would be aware of the fact that simply having a website for businesses is not enough.

While merchants today are offering mobile apps to the customer to increase conversion rates, and provide a better user experience by personalizing the shopping experience, the loyal customers needs to be retained and should always have a hassle-free experience for subscriptions. Instead of reinventing something that’s already been refined, we chose a proven approach. Below is the straightforward process to integrate subscriptions with your mobile app.

Step by step guide to implement subscriptions:

  1. Do a POST request for the respective product by calling the Shopify GraphQL API to get the selling plan details associated with the product.

    Endpoint:

    https://xyz.myshopify.com/admin/api/2025-01/graphql.json


    Payload:

    {
    product(id: "gid://shopify/Product/10274xxxxx") {
    id
    sellingPlanGroupsCount {
    count
    precision
    }
    sellingPlanGroups(first: 25) {
    edges {
    node {
    id
    name
    description
    options
    position
    sellingPlans(first: 25) {
    edges {
    node {
    id
    name
    description
    options
    position
    deliveryPolicy {
    ... on SellingPlanRecurringDeliveryPolicy {
    interval
    intervalCount
    }
    }
    billingPolicy {
    ... on SellingPlanRecurringBillingPolicy {
    interval
    intervalCount
    }
    }
    pricingPolicies {
    ... on SellingPlanFixedPricingPolicy {
    adjustmentType
    adjustmentValue {
    ... on SellingPlanPricingPolicyPercentageValue {
    percentage
    }
    }
    }
    ... on SellingPlanRecurringPricingPolicy {
    adjustmentType
    adjustmentValue {
    ... on SellingPlanPricingPolicyPercentageValue {
    percentage
    }
    }
    afterCycle
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }


    Response:

    {
    "data": {
    "sellingPlanGroups": {
    "edges": [
    {
    "node": {
    "id": "gid://shopify/SellingPlanGroup/80879517970",
    "name": "Monthly Subscription",
    "description": "You will receive an order every month",
    "merchantCode": "subscribe-and-save",
    "options": [
    "1 Monthly(s)"
    ],
    "position": null,
    "productsCount": {
    "count": 1,
    "precision": "EXACT"
    },
    "sellingPlans": {
    "edges": [
    {
    "node": {
    "id": "gid://shopify/SellingPlan/694822174994",
    "name": "Monthly Subscription",
    "description": "You will receive an order every month",
    "options": [
    "1 Monthly(s)"
    ],
    "position": null,
    "category": "SUBSCRIPTION",
    "deliveryPolicy": {
    "interval": "MONTH",
    "intervalCount": 1,
    "anchors": [],
    "cutoff": null,
    "intent": "FULFILLMENT_BEGIN",
    "preAnchorBehavior": "ASAP"
    },
    "billingPolicy": {
    "interval": "MONTH",
    "intervalCount": 1,
    "anchors": [],
    "createdAt": "2025-08-11T18:21:20Z"
    },
    "inventoryPolicy": null,
    "pricingPolicies": [
    {
    "adjustmentType": "PERCENTAGE",
    "adjustmentValue": {
    "percentage": 10.0
    }
    }
    ],
    "createdAt": "2025-08-11T18:21:20Z"
    }
    }
    ]
    },
    "summary": "1 delivery frequency, 10% discount",
    "createdAt": "2025-08-11T18:21:20Z"
    }
    }
    ]
    }
    },
    "extensions": {
    "cost": {
    "requestedQueryCost": 87,
    "actualQueryCost": 7,
    "throttleStatus": {
    "maximumAvailable": 2000.0,
    "currentlyAvailable": 1993,
    "restoreRate": 100.0
    }
    }
    }
    }


  2. The response received from the above API call will have the subscription plan info which needs to be shown to the end customer.

    Loop the sellingPlans array to fetch the plan details. The selling plan is an array of objects which will contain the selling plan id, name, description and discount that needs to be shown to the end customer. Create a dropdown with all the plan names for the respective product, add it as an option, and show it to the end customer.


    ​The selling plan id is mandatory to add a subscription product using Shopify checkout.

  3. While calling add.js API to add a selected product to the cart pass the selected selling_plan_id as a parameter in the add.js data object, this is an identifier for Shopify to consider this product as a subscription product in cart.

  4. When the customer clicks on the checkout. Use Shopify storefront cart API to create a cart with the items where in the line item object you will be passing the selling_plan_id of the subscription plan selected by the customer for subscription items.

  5. Use Shopify checkout URL API to generate a checkout link for the Cart ID you have received on the last step. This will return the Shopify checkout URL in response along with subscription products on which you can redirect the customers directly.


Facing any issue with integrations? Click the green chat button or write us at help@recurpay.com

Did this answer your question?