Search code examples
javascriptphprubynode.jsrecurly

What's the equivalent of this function to update a subscription and account info in Recurly JS?


I contacted Recurly and they don't want to offer any support on this.

I need to know the objects specific format otherwise Recurly will bounce if any extra data is sent or if you don't have the exact arguments for the query (which are different for each function).

Ruby:

subscription = Recurly::Subscription.find('uuid')
subscription.update_attributes(
  :plan_code => 'silver',...

PHP, Pyton, XML = (also in the docs)

NodeJS = ?????????? (we have no clue)

Much thanks!!!

PS. This is the response I got from Recurly,

Hi Turk, Thank you for your note. Understanding of the question is whether there is a Javascript equivalent for updating billing information. The only supported options we can offer are as follows: - using the Recurly.js V3 form (https://docs.recurly.com/js/), to create new accounts, add billing info, and create a subscription - update billing info through the API's. (https://dev.recurly.com/docs/lookup-an-accounts-billing-info)

I hope this is helpful. Thank you again. Regards,

Ian Recurly Support

PSS. I also tried to contact their technicians via IRC - irc://chat.freenode.net:+6697/recurly but no luck again.


Solution

  • Recurly.js is Recurly's name for a front-end web technology that enables the merchant to easily build their subscription checkout and accept payments. Using this library, merchants can tokenize payment information, display price/tax previews, and validate customer inputs. Because it is client-side, it can NOT be used to create or modify accounts, subscriptions, transactions, etc.

    In order to perfrom CRUD operations in Recurly, you must use its RESTful Web Services API, either directly or through one of the provided wrappers (in PHP, Ruby, Python, and C#.NET). Recurly itself does not provide a supported API wrapper for NodeJS, although a 3rd-party one exists and has been used successfully. This library contains functions to update an existing account and update an existing subscription.

    To update account '1234', you would use:

    recurly.accounts.update('1234', {email: '[email protected]'}, function(res){
     console.log(res['data']);
    })
    

    The second argument to this function is a JSON representation of the values that are changing. Available parameters are listed here.

    To update subscription '32d7e59b0def37ddfabbd54d1296145b', you would use:

    recurly.subscriptions.update('32d7e59b0def37ddfabbd54d1296145b', { quantity: 5 }, function(res){
     console.log(res['data']);
    })
    

    The second argument to this function is a JSON representation of the values that are changing. Available parameters are listed here.

    -Charlie (Sales Engineer @ Recurly)