Skip to main content
All CollectionsIntegrationsBuilding with Recurpay
Integrate Recurpay with your Mobile App using Recurpay checkout
Integrate Recurpay with your Mobile App using Recurpay checkout

How to integrate Recurpay with any mobile app in just few hours

Sinchain avatar
Written by Sinchain
Updated over a year 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. We could have chosen to build the feature ourselves but we know we couldn't have done it better than you so here is a simple process for integrating Recurpay with your mobile app:

Note: The steps are only for Recurpay checkout and not for any other ecommerce platforms native checkout.

Showing the subscription options on the Product page.

  1. Do a GET request for the respective product by calling the Plans API to get the selling plan details from Recurpay along with the product details in the payload.

    https://{{recurpay_domain}}/api/storefront/v2/plans

    Payload:

    {
    "products": [
    "{{dynamic_product_id}}"
    ]
    }

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

    Loop the plans array and fetch the plan details. The plans is an array of objects which will contain the plan id, plan name, 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 and selling_plan_group_id won't be required here since it's not a native shopify checkout integration.

  3. While calling add.js or change.js API to add a selected product on the cart pass the selected plan id as parameter _PlanId and plan name as parameter Plan in the properties object.

    https://shopify.dev/docs/api/ajax/reference/cart#add-line-item-properties
    Eg: https://{{shop.permanent_domain}}/cart/add.js

  4. When the customer clicks on the checkout, loop in through all the items in the cart. If any of the items in the cart contains the line item property _PlanId that means it's a subscription product and Recurpay checkout needs to be initiated otherwise initiate the normal Shopify checkout.

    To initiate Recurpay checkout, call our Initiate Checkout API along with the cart data in below format:

    Eg: https://{{recurpay_domain}}/api/storefront/v2/checkout

Note: In case any of the line item is not a subscription item just don't pass the entire plan object for that specific line item. 

5. You will get a checkout URL from the initiate checkout API response called in Step 4. Just redirect the customer to the specific URL received in the response and it's done :)


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

Did this answer your question?