Using Hosted Payment Pages with Rails..?

ebyte's Avatar

ebyte

22 Dec, 2011 12:51 PM

I want to use CheddarGetter's hosted payment pages in a Rails app that I'm developing, but I'm a little confused as to how it works. I've read http://support.cheddargetter.com/kb/hosted-payment-pages/hosted-pay... over and over but I still have a few questions.

I understand that this will be the process if I integrate this with my app:

User signs up at my site -> redirected to pay at CheddarGetter -> redirected to my site's log-in page -> check CheddarGetter if customer record exists -> if yes, let them in the site; if no, deny access

Sounds good. My question basically revolves around the customer key... When exactly should I generate it? As I understand it, I'll be creating this token once the user is created. Should this token be passed on to CG, and will CG store it? How should I pass it to CG?

Is this what's being validated in CG before log in? I can make it so that my app stores the unique customer key for each customer. I need to, because if I'm going to provide cancellation and update links they need to include the customer key.

Sorry if it sounds a little bit over the place. I wish you guys had a screencast or something on how to integrate CG with Rails at it seems to be a great solution for SaaS apps.

Thanks.

  1. 1 Posted by ebyte on 22 Dec, 2011 03:25 PM

    ebyte's Avatar

    A few hours later, I've figured out a few answers.

    YES, you do have to create the MD5 sum when your user first signs up. I don't think CG stores this, so I just stored it in my own database, and pull it out when I need to reference (giving customers links to update or cancel their plans).

    Now if I can only figure out how to check customer status after log-in, I'm signing up for CG in a jiffy :)

  2. Support Staff 2 Posted by Marc Guyer on 22 Dec, 2011 03:42 PM

    Marc Guyer's Avatar

    CG doesn't store the customer key but it is easily generated on-the-fly. This is recommended since the secret key could change in the future. You have the ability to change it if you think it was compromised in some way.

    Now if I can only figure out how to check customer status after log-in, I'm signing up for CG in a jiffy :)

    There are two ways to check status. The quick way is to use the status request feature of the hosted pages as documented here:

    https://articledesk.chargevault.com/status?code=joedoe%40gmail.com&...

    Alternatively, you can use the API to get customer info and determine status. The ruby wrapper makes this quite easy.

  3. 3 Posted by ebyte on 22 Dec, 2011 03:54 PM

    ebyte's Avatar

    Hey Marc, thanks for the reply. I'm pretty much set on using the first method to request customer status prior to log in. I'm just not very familiar with Net::HTTP , and how exactly to use the Ruby code provided here. If you guys could give me a nod towards a particular direction, I'd really appreciate it.

  4. Support Staff 4 Posted by Marc Guyer on 22 Dec, 2011 04:01 PM

    Marc Guyer's Avatar

    If I'm not mistaken, Net::HTTP is a standard Ruby lib so you can just use it. Have you tried that example code?

  5. 5 Posted by ebyte on 22 Dec, 2011 04:07 PM

    ebyte's Avatar

    I would, if I knew where exactly to put it in my Rails app. But I'm researching on that now, hopefully I'll figure it out soon.

  6. 6 Posted by ebyte on 24 Dec, 2011 12:13 AM

    ebyte's Avatar

    I ended up figuring this out, finally. CG team, I wish you guys had an official screencast or a tutorial on integrating CG with Rails, as it really is a great solution once you have it working!

  7. 7 Posted by adam on 24 Dec, 2011 02:14 PM

    adam's Avatar

    One of our devs is currently working on revising and improving the cheddargetter-client-rails gem:
    https://github.com/BrentW/cheddargetter_client_rails

    Once he finishes that (next month or so) I'll work on getting a screencast together. That's a good idea.

    Thanks,
    Adam

  8. Marc Guyer closed this discussion on 28 Dec, 2011 05:57 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM