#Sarvesh

1 messages ยท Page 1 of 1 (latest)

gilded ingotBOT
fickle plank
#

๐Ÿ‘‹ how may I help?

wet gazelle
#

I want to make monthly / yearly service subscriptions using Stripe+ PHP

#

can you share a code snippet link for it

fickle plank
wet gazelle
#

we will show a payment data form on our website and post it to stripe

fickle plank
#

a payment data
what do you mean by that?

wet gazelle
#

card or bank details

#

form

fickle plank
#

your own input?

wet gazelle
#

no from stripe but will just show it on our website

fickle plank
#

ok then the Link I sent is should be enough

wet gazelle
#

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'],
]);

fickle plank
#

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

wet gazelle
#

ok,

#

which webhook events needs to subscribe to get fail/success data

fickle plank
wet gazelle
#

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

fickle plank
#

if you choose charge_automatically as the collection method, then yes Stripe will handle the payment for the recurring invoices

gilded ingotBOT
atomic valve
#

Hi! I'm taking over my colleague. Please, let me know if you have any other questions.