Dec
03
2008

In regards to my last post about Billing

I mentioned in my last post I was integrating Intrannuity into the http://www.chrrch.com website.  Ultimately, we decided that we were not a good match for their system.  Although I said many good things about their business (all were true, they are a good business to work with), their billing model just did not add up to what we were looking for.

Intrannuity requires the user of their system to set up billing cycles prior to using them.  What I mean by this is you cannot just have someone sign up on any random day and bill on that same day every month unless you create a billing cycle for this on their system before they sign up.  They allow for lots of customization for invoicing and things of that nature but, we were looking for a system that people can just subscribe to our service and get the bill every month on the day they signed up.

The service we ended up going with is Paypal’s Instant Payment Notification system (IPN).  This service is not as nice as what we were looking at before but, accomplishes our main goal with billing (not having to prorate costs due to their bill being set up on a certain billing date, etc).  Unfortunately, going with Paypal IPN, you must forward them to Paypal’s website rather than having all billing integrated into your product alone.  While setting up the service, I discovered several things that were either really hard to find answers for or were unanswered.

The way this service works is you create a page that once the payment is completed on Paypal’s website, it passes information to this created page so that your service is informed of the completed transaction.  This page is not the same page that the paying customer will see either.  It is used to update database information, send emails, etc.  Now, onto my comments about this service.

First off, Paypal has the WORST method of reaching them by phone.  It is more pleasant going to the dentist’s office than it is calling their number and trying to reach an actual human being (yes, they do exist, it just takes patience it seems to reach them).  Once I did get in contact with a representative, he was foreign but, he spoke clearly and was as helpful as could be.  Unfortunately for him, his answer was not the one I was looking for and I had to be transfered to his supervisor.  His supervisor did not have the answer I was looking for either because I was calling in regards to their sand box/development site which is an affiliate company to Paypal and there is no way to reach this company by phone (they have a ticket system [you submit a hlep ticket, they answer it within 24 hours]).

Next, there is the issue of getting the information you need to pass over to Paypal and then returning the information from Paypal back to your service.  This was the reason I had to call Paypal in the first place (I was having trouble with passing custom variable information over to Paypal and back).  There are three ways I found you can do this: Paypal hosted buttons, Paypal generated encrypted buttons, and create your own buttons.  This is where it got hairy for me.

…Just a warning, the rest of this post applies to making buttons for Paypal.  My problem dealt specifically with Subscription Butons.  Now, on with the rest…

When creating a button on Paypal’s sand box website, it it gives you a three part form to fill out which is pretty straight forward except for the use of custom variables.  It allow syou to add a custom variable but, it will have the same value EVERY time.  This seems unnecessary to pass over a variable that will always have the same value.  Never the less, it generates the code for you to use which is shown below.

Paypal Hosted Button
<form action=”https://www.sandbox.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_s-xclick”>
<input type=”hidden” name=”hosted_button_id” value=”6489″>
<input type=”image” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribe_SM.gif” border=”0″ name=”submit” alt=”">
<img alt=”" border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>

After I did some research as to how to get a custom variable passed over to Paypal, I thought I had figured it all out.  There is an option on the second part of the form offered by the Paypal button generator to not have Paypal host the button for you.  This generates a button with all the information encrypted into a string of characters.  The code is shown below.

Paypal Encrypted Button

<form action=”https://www.sandbox.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_s-xclick”>
<input type=”hidden” name=”encrypted” value=”—–BEGIN PKCS7—–TONS OF ENCRYPTED TEXT—–END PKCS7—–
“>
<input type=”image” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif” border=”0″ name=”submit” alt=”">
<img alt=”" border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>

From what I had read, it seemed all I needed to do is add <input type=”hidden” name=”custom” value=”WHATEVER VALUE”> and I would have myself a dynamically generated variable value but, every time I submitted information this way, it NEVER worked out.  This frustrated me for so long.  I had seen where people were having no trouble accomplishing this task of passing custom information over to their IPN receiving page.  I was at ends with how to do this.  Finally, I removed the encryption from the code above and started getting new responses.  They were not great ones but, were nevertheless better than completed transactions without the variables I was passing into the system.

The final solution came when I found a Paypal Subscription Button Generator on Justin Cook’s blog (Thank you, Justin BTW).  I generated a button and then found all the variables that were required to get a completed transaction from a custom button with all the information I needed to pass over to Paypal.  The complete code needed to submit a custom button to Paypal’s IPN service is below.

Custom Made Button
<form action=”https://www.sandbox.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_xclick-subscriptions”>
<input type=”hidden” name=”business” value=”THIS IS YOUR ACCOUNT EMAIL”>
<input type=”hidden” name=”item_name” value=”">
<input type=”hidden” name=”item_number” value=”THIS IS OPTIONAL”>
<input type=”hidden” name=”amount” value=”ITEM COST”>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”bn” value=”PP-SubscriptionsBF”>
<input type=”hidden” name=”Currency_Code” value=”USD”>
<input type=”hidden” name=”Charset” value=”UTF-8″>
<input type=”hidden” name=”a3″ value=”ITEM COST”>
<input type=”hidden” name=”p3″ value=”1″>
<input type=”hidden” name=”t3″ value=”M”>
<input type=”hidden” name=”src” value=”1″>
<input type=”hidden” name=”sra” value=”1″>
<input type=”hidden” name=”custom” value=”">
<input type=”image” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif” border=”0″ name=”submit” alt=”">
<img alt=”" border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>

The IPN service is nice if you have a good idea of what is needed to accomplish the task.  I hope that if you are trying to solve the same issues I was having that my blog has helped you come up with a solution.

Written by admin in: Chrrch | Tags: , , , , ,

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes