I am following this tutorial https://pippinsplugins.com/stripe-integration-part-4-multiple-recurring-payment-options/
Every thing worked fine until i tried to retrieve stripe plans. it gives me this error when i inspect. Fatal error: Call to undefined function pippin_get_stripe_plans () in /includes/myplugin/shortcodes.php on line 45
Here is my shortcode.php which is creating this problem
<div class="sk-form-row" id="stripe-plans" style="display:none;">
<label><?php _e('Choose Your Plan', 'pippin_stripe'); ?></label>
<select name="plan_id" id="stripe_plan_id">
<?php
$plans = pippin_get_stripe_plans();
if($plans) {
foreach($plans as $id => $plan) {
echo '<option value="' . $id . '">' . $plan . '</option>';
}
}
?>
</select>
</div>
and i am calling it from stripefunction.php
<?php
function pippin_get_stripe_plans() {
global $stripe_options;
// load the stripe libraries
require_once(STRIPE_BASE_DIR . '/Stripe-php/init.php');
// check if we are using test mode
if(isset($stripe_options['test_mode']) && $stripe_options['test_mode']) {
$secret_key = $stripe_options['test_secret_key'];
} else {
$secret_key = $stripe_options['live_secret_key'];
}
\Stripe\Stripe::setApiKey($secret_key);
// retrieve all plans from stripe
$plans_data = \Stripe\Plan::all();
// setup a blank array
$plans = array();
if($plans_data) {
foreach($plans_data['data'] as $plan) {
// store the plan ID as the array key and the plan name as the value
$plans[$plan['id']] = $plan['name'];
}
}
return $plans;
}
probably not needed but here is the jquery i am using for the drop down to show the plans.
$('input[name|="recurring"]').change(function() {
if($(this).val() == 'yes') {
$('#stripe-plans').slideDown();
} else {
$('#stripe-plans').slideUp();
}
});