#Sarvesh
1 messages ยท Page 1 of 1 (latest)
๐ how may I help?
I want to make monthly / yearly service subscriptions using Stripe+ PHP
can you share a code snippet link for it
we will show a payment data form on our website and post it to stripe
a payment data
what do you mean by that?
your own input?
no from stripe but will just show it on our website
ok then the Link I sent is should be enough
from JS element
as per the link, it first creates pricing modal and then customer on stripe.
Is it mandatory or can we create it on our website only and just pass the price, currency and customer id etc. directly to create subscription object?
Create the subscription with the customer ID, price ID, and necessary options.
$subscription = $stripe->subscriptions->create([
'customer' => $customer_id,
'items' => [[
'price' => $price_id,
]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);
Is it mandatory or can we create it on our website only and just pass the price, currency and customer id etc. directly to create subscription object?
you can pass in price_data yes
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok
for the recurring payments monthly/yearly - do we need to write any crobjob to call any stripe APIs to deduct amount from customer account or Stripe will do it directly and notify us via website to update the stauts?
*website=>webhook
if you choose charge_automatically as the collection method, then yes Stripe will handle the payment for the recurring invoices
Hi! I'm taking over my colleague. Please, let me know if you have any other questions.