PHP Stripe Integration
<p>I've been having trouble integrating Stripe into my website as it seems every time I solve a problem a different one arises.</p>

<p>I've decided to use the local Stripe folder library instead of installing it.</p>

<p>My buy page looks like this:</p>

<pre><code>&lt;body&gt;

    &lt;?php require_once('./config.php'); ?&gt;

    &lt;form action="charge.php" method="post"&gt;
    &lt;script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
      data-key="&lt;?php echo $stripe['publishable_key']; ?&gt;"
      data-description="Access for a year"
      data-amount="5000"
      data-locale="auto"&gt;&lt;/script&gt;
 &lt;/form&gt;           
&lt;/body&gt;
</code></pre>

<p>My charge.php looks like this:</p>

<pre><code>&lt;?php
  require_once('./config.php');
  $token  = $_POST['stripeToken'];
  $customer = \Stripe\Customer::create(array(
      'email' =&gt; 'customer@example.com',
      'source'  =&gt; $token
  ));
  $charge = \Stripe\Charge::create(array(
      'customer' =&gt; $customer-&gt;id,
      'amount'   =&gt; 5000,
      'currency' =&gt; 'usd'
  ));
  echo '&lt;h1&gt;Successfully charged $50.00!&lt;/h1&gt;';
?&gt;
</code></pre>

<p>Lastly, my config.php: (stars replaced my keys)</p>

<pre><code>&lt;?php
require_once('./Stripe/init.php');
$stripe = array(
  "secret_key"      =&gt; "sk_test_***********************",
  "publishable_key" =&gt; "pk_test_***********************"
);
\Stripe\Stripe::setApiKey($stripe['secret_key']);
</code></pre>

<p>My Stripe library folder is on the same level as my other pages, which could be my problem, to present this I'll make a leveled bullet list:</p>

<ul>
<li>config.php</li>
<li>index.php</li>
<li>charge.php</li>
<li>Stripe (folder)

<ul>
<li>Contents in folder</li>
</ul></li>
</ul>

<p>What am I doing wrong? I've uploaded my folder to my Webhost server and when I go to the page where there's supposed to be a button, I receive an error:</p>

<blockquote>
  <p>Warning:
  require(/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php):
  failed to open stream: No such file or directory in
  /home1/desmoriz/public_html/Stripe/init.php on line 32</p>
  
  <p>Fatal error: require(): Failed opening required
  '/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php'
  (include_path='.:/opt/php56/lib/php') in
  /home1/desmoriz/public_html/Stripe/init.php on line 32</p>
</blockquote>