Recharge Shopify Subscription API

20 0 5

Hey all!


I'm building a development store for a client, and have integrated Recharges new version app (no longer redirects to 3rd party checkout, instead uses Shopify new Subscriptions API, and checks out with Shopify)


Anyone had any experience yet of setting up AJAX addtocart using the selling plan id yet? (for ajax, Recharge used to take shipping interval type and frequency as properties before, and redirect to their checkout if a subscription was included)


The following works and shows the correct subscription on the checkout page BUT I can't test as its in development mode (Shopify only allows test payments now!!)


This seems so easy that I'm feeling a little uneasy! Anyone tried this new API out yet on a live site?


  function addToCart(id, qty, sellingplan){

      type: 'POST', 
      url: '/cart/add.js',
      dataType: 'json', 
      data: {
        'items': [{
          'id': id,
          'quantity': qty,
          "selling_plan": sellingplan 
      success: addToCartOk,
      error: addToCartFail