Skip to content

Instantly share code, notes, and snippets.

@dannymcc
Created November 19, 2012 11:25
Show Gist options
  • Select an option

  • Save dannymcc/4110211 to your computer and use it in GitHub Desktop.

Select an option

Save dannymcc/4110211 to your computer and use it in GitHub Desktop.
Danny M. I can find the first subscription using the API, and I can list all of the subscriptions in my local table.
11:20 AM
Danny M. What I can't do is list all of the local subscriptions and get the missing information from the API.
My subscription table has resource_id which I would like to then lookup the amount and interval details etc.
Tim R. Liviu - The customer does make an account, but ti's only a very quick process at the end of setting up the payment
You should be able to do GoCardless::Subscription.find(subscription_record.resource_id)
where subscription_record is an item from the table
Liviu P. ok, thanks Tim
Danny M. I'm a little confused as to where that should be? In my subscriptions controller?
I don't seem to be able to find any records unless I set the merchant ID in the controller
Tim R. most likely
It shouldn't be necessary, but it's okay to do that
Danny M. So should subscription_record be replaced with the resource_id ?
GoCardless::Subscription.find(subscription_id.resource_id)
Tim R. No. You need to pass into the GoCardless::Subscription.find function whatever is the ID of the subscription on GoCardless
Danny M. And the second resource_id should be id as that's what it's listed from the API?
11:25 AM
Tim R. I believe that's what is stored as resource_id in your database
Danny M. Ahh ok, I think I understand.
I'll have a look!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment