Я хочу реализовать ежемесячную подписку с Stripe и PHP.Я следовал этим инструкциям: https://stripe.com/docs/recipes/subscription-signup#creating-the-signup-form-using-checkout
1- Я зашел на панель инструментов и создал продукт: ежемесячная плата и план 9,99 евро / месяц с названием Monthly1.Допустим, идентификатор продукта: prod_222222w
2- Index.php:
<form action="create_subscription.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_SomeNumbersAndLetters"
data-image="images/stripe.png"
data-name="F. subscription"
data-description="9.99 montly fee"
data-amount="999"
data-label="Sign Me Up!">
</script>
</form>
3-create_subscription.php.Я установил Composer и думаю, что он хорошо работает
require_once('vendor/autoload.php');
\Stripe\Stripe::setApiKey("sk_test_SomeNumbersAndLetters");
try
{
$customer = \Stripe\Customer::create(array(
'email' => $_POST['stripeEmail'],
'source' => $_POST['stripeToken'],
));
$subscription = \Stripe\Subscription::create(array(
'customer' => $customer->id,
'items' => array(array('plan' => 'weekly_box')),
));
header('Location: thankyou.php');
exit;
}
catch(Exception $e)
{
header('Location:oops.php');
error_log("unable to sign up customer:" . $_POST['stripeEmail'].
", error:" . $e->getMessage());
}
Если я понимаю, мне нужно изменить идентификатор плана.Куда мне это положить?
Если я понимаю, мне нужно поменять также stripeToken и stripeEmail.Если так, то где я это получу и куда мне положу?
Извините, я очень смущен.Я не программист.Я учу себя.Мне удалось создать сайт, но реализация Stripe - самая сложная часть.Буду признателен за любую ориентацию.