My mom called me last night. She owns a hot tub dealership in the Salt Lake City area. She said she had a woman come in and purchase a top of the line hot tub the other day. The woman said, \”I\’m glad I found you. You were not on Google when I searched. Someone up the street said I should check out your store.\”

My mom has been paying some company $320 per month for the last nine months that promised to get her on the first page of Google. They have literally done nothing except continue to bill her month after month.

I don\’t know how effective an SEO campaign would be if you are only paying $320 per month, but I know I could take half that and start getting lots more exposure than she is getting just by using Google Adwords.

Basically my mom was calling to ask if she could send that money to me instead in return for me helping her get more traffic. I agreed to do it. I have enough experience that I put together a simple marketing plan for her so I can start to get her more customers and as I prove I can get a lot better ROI, then we can increase our marketing spending and efforts, and I can hire a virtual assistant to do the majority of the work.

But this post isn\’t really about marketing, SEO, or hiring VAs. My first order of business was to figure out how to allow my mom to set up an auto payment plan on her business credit card to put that $320 into my account each month.

Without doing much research I turned to stripe, because I know I could get it set up fairly quickly with their API. And it was relatively quick. It took me about 2 hours to do the research and create the page. It is nothing fancy.

First I created a folder on my server named payments and dropped the lib folder of the PHP Stripe API library into it.

I created a config.php file with the following:

<?php
require_once(\'./lib/Stripe.php\');

$stripe = array(
  &quot;secret_key&quot;      =&gt; &quot;<strong>my_secret_key</strong>&quot;,
  &quot;publishable_key&quot; =&gt; &quot;<strong>my_publishable_key</strong>&quot;
);

Stripe::setApiKey($stripe[\'secret_key\']);
?&gt;

I created a subscription plan on the Stripe admin page and gave it an ID of \”soakers320\”. Then I created this very simple index.php page:

&lt;?php

if($_SERVER[&quot;HTTPS&quot;] != &quot;on&quot;)
{
    header(&quot;Location: https://&quot; . $_SERVER[&quot;HTTP_HOST&quot;] . $_SERVER[&quot;REQUEST_URI&quot;]);
    exit();
}

if ($_SERVER[\'REQUEST_METHOD\'] == \'POST\') {
    require_once(dirname(<strong>FILE</strong>) . \'/config.php\');

<pre><code>$token  = $_POST[\'stripeToken\'];

$customer = Stripe_Customer::create(array(
    \'email\' =&amp;gt; \'customer@example.com\',
    \'card\'  =&amp;gt; $token,
    \'plan\'  =&amp;gt; \'soakers320\'
));

echo \'&amp;lt;h1&amp;gt;Successfully charged $320.00. Thank you!&amp;lt;/h1&amp;gt;\';
exit;
</code></pre>

}

?&gt;&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Red Seam Marketing Subscription&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php if ($_SERVER[\'REQUEST_METHOD\'] == \'GET\'): ?&gt;

&lt;script src=&quot;https://checkout.stripe.com/v2/checkout.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;https://code.jquery.com/jquery-2.1.1.min.js&quot;&gt;&lt;/script&gt;

&lt;form method=&quot;post&quot;&gt;
  &lt;/form&gt;

&lt;script&gt;
    $(document).ready(function(){
      var token = function(res){
        var $input = $(\'&lt;input type=hidden name=stripeToken /&gt;\').val(res.id);
        $(\'form\').append($input).submit();
      };

<pre><code>  StripeCheckout.open({
    key:         \'**my_publishable_key**\',
    address:     true,
    currency:    \'usd\',
    name:        \'Marketing\',
    description: \'Marketing Plan for Soakers.biz\',
    panelLabel:  \'Subscribe\',
    token:       token,
    allowRememberMe: false
  });

  return false;
});
</code></pre>

&lt;/script&gt;
&lt;?php endif; ?&gt;

&lt;/body&gt;
&lt;/html&gt;

Some notes on the code:

Lines 3-7: I should also mention I purchased a $9.00 SSL certificate at namecheap.com for added security. This code ensures that the page is only accessed via https.

Lines 9-22: After the form is filled out and submitted, it creates a form past back to this page. This is the call that creates the customer using the subscription plan and actually charges their card.

Lines 41-59: This creates the Checkout form that generates the card token that is passed into this page when it is posted.

That\’s about it! Let me know if you have questions on any other portions of this code.