Site icon Hip-Hop Website Design and Development

Integrating Stripe PHP library right into a customized WordPress Plugin

I’m attempting to create a easy ‘add month-to-month Subscriptions(Month-to-month funds) button’ customized plugin for a purchasers WordPress web site. My present situation is how am I to incorporate Stripe’s PHP library within the plugin? I’ve Stripe operational working it by Composer (autoload.php) domestically. However including it to WordPress….

I’ve added the essential code from Stripe’s web site under:
https://stripe.com/docs/recipes/subscription-signup

 <type motion="/create_subscription.php" technique="POST">
  <script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="pk_test_mlHAlLZMWfb2URJZIvb6Qntd"
    data-image="/photographs/market.png"
    data-name="Emma's Farm CSA"
    data-description="Subscription for 1 weekly field"
    data-amount="2000"
    data-label="Signal Me Up!">
  </script>
</type>

That is the PHP.

<?php // Create a buyer utilizing a Stripe token

// In case you're utilizing Composer, use Composer's autoload:
require_once('vendor/autoload.php');

// Be sure you change this along with your precise take a look at API key
// (swap to the reside key later)
StripeStripe::setApiKey("sk_test_000000000000");

attempt
{
  $buyer = StripeCustomer::create(array(
    'e-mail' => $_POST['stripeEmail'],
    'supply'  => $_POST['stripeToken'],
    'plan' => 'weekly_box'
  ));

  header('Location: thankyou.html');
  exit;
}
catch(Exception $e)
{
  header('Location:oops.html');
  error_log("unable to enroll buyer:" . $_POST['stripeEmail'].
    ", error:" . $e->getMessage());
}

Any assist could be appreciated!