I'm not finding anything my searching for a answer.
I know things can be done more efficiently with modx. i dont really want a bunch of .php files roaming around when they could just be snippits.... but i'm lost on how to do this....
implementing stripe.com payments from
https://gist.github.com/maccman/2f110e12237b4d83ae8c
Subscribe resource. aka index.php in the link...
<?php require_once('./config.php'); ?>
<form action="charge.php" method="post">
<script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-amount="5000" data-description="One year's subscription"></script>
</form>
config.php
<?php
require_once('./lib/Stripe.php');
$stripe = array(
secret_key => getenv('secret_key'),
publishable_key => getenv('publishable_key')
);
Stripe::setApiKey($stripe['secret_key']);
?>
charge.php
<?php
require_once(dirname(__FILE__) . '/config.php');
$token = $_POST['stripeToken'];
$customer = Stripe_Customer::create(array(
'email' => '[email protected]',
'card' => $token
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged $5!</h1>';
?>
my thought is all these require_once(dirname(__FILE__) . '/config.php'); could then just call a snippit with the code in there... As that seems more the modx way... just dont know the right way to call it...