maxio-com / chargify_direct_example

Small Sinatra app that demonstrates Chargify Direct using the Chargify2 gem
MIT License
12 stars 12 forks source link

Fetching call resource fails with 401 #1

Closed josephruscio closed 12 years ago

josephruscio commented 12 years ago

Not sure if this is a problem with this example app or the chargify2 gem or the API itself, but when I attempted to use this app with our testing chargify subdomain, the initial POST to create a new subscription works, but the attempt to query the Call Resource using the call ID (i.e. chargify.calls.read(params[:call_id])) fails with a 401:

get '/verify' do
  if chargify.direct.response_parameters(params).verified?
    @call = chargify.calls.read(params[:call_id])

I tried using curl on the command line with my api_id and api_password and got the same 401.

moklett commented 12 years ago

I just tried this out and it worked for me. Maybe your password is incorrect? I can reset it and send you a new one.

josephruscio commented 12 years ago

The password is fine, as I said the initial POST to create the new subscription works, it's just the subsequent attempt to fetch the call resource that fails.

Kori Francis at Chargify just replicated the issue with my information. Maybe there's something wrong with how they enabled my closed-beta access to the feature? In any case, as I mentioned, I have the same problem with straight curl. So this is probably an issue on the Chargify API side and not with your reference application. I'll close this as soon as Kori verifies something to that effect.

josephruscio commented 12 years ago

Yes I have V2 credentials, and more importantly, they're working to on the initial POST from the form provided in this reference implementation to create an account. So my V2 credentials are confirmed to work end-to-end on creating a new subscription, but they fail on the GET request to fetch the call resource using the ID returned in the re-direct.

moklett commented 12 years ago

@josephruscio the initial chargify direct POST uses your api_secret to sign the form post (since it can be considered "public"). The API call portion uses your api_password for a server-to-server operation. Are you using the right ones in the right place?

josephruscio commented 12 years ago

@moklett I was using the password I was originally provided, but thanks for the insight. This makes a lot more sense now. It looks like my password has just been reset, and it works now.

moklett commented 12 years ago

Good to hear. We'll be making the credentials more self-service soon and beefing up the docs on this feature. We're also working on a better sample app as we speak.