#devparry

1 messages · Page 1 of 1 (latest)

round pineBOT
narrow obsidian
#

Hi there!

sonic laurel
#

hi

narrow obsidian
#

I don't think that's possible, Payment Links always create new Customer objects.

sonic laurel
#

actually the user already take subscription which is trail one

narrow obsidian
sonic laurel
#

but that time we dnt take any payment details

#

could you please explain this to me how i can set here subscription data ?

narrow obsidian
#

So if I understand correctly: you create a Payment Link with a free trial subscription without colelcting a payment method. What exactly is your issue?

sonic laurel
#

no no

#

user already take free trail

#

now we want to send him paid payment subscription link

narrow obsidian
#

You want to collect a payment method for the existing customer, so they can pay for their subscription when the trial ends?

sonic laurel
sonic laurel
#

we want user can take paid subscription

#

trail is different

#

in our system user can take multiple subscriptions at same time

#

we want if user done payment with payment link

narrow obsidian
#

Sorry I still don't understand your issue. Can you clarify exactly what you are trying to do, and which part is not working?

sonic laurel
#

lets start with fresh

#

https://buy.stripe.com/test_aEU29l6sg548eWsaEE

we create this payment link and we have an existing user who already has a customer id under stripe.

  • so when the user enters details such as email id name which is the same as the existing one.
round pineBOT
sonic laurel
#

the stripe creates a duplicate customer with same email id please have a look

#

how we can avoid this duplicate issue ?

hearty wolf
#

👋 taking over for my colleague. Let me catch up.

sonic laurel
#

We want to register the new transactions under the existing customer profile when an existing customers make a payment via the payment link

hearty wolf
#

Payment Links have this limitation

#

each checkout session spawned from the payment link will generate a new customer

sonic laurel
#

so how we counter this

hearty wolf
#

unfortunately using Payment Links you can't

#

instead you need to create Checkout Sessions yourself

sonic laurel
#

so that when existing user done payments new transactions under the existing customer profile

hearty wolf
#

and pass in the Customer ID

sonic laurel
hearty wolf
sonic laurel
#

will this work for one-time payments or for subscriptions ?

#

$stripe = new \Stripe\StripeClient('sk_test_kUEKa5cQJKm0pYSInlvmEHSL0084KLYEX1');
$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'line_items' => [
[
'price' => 'price_H5ggYwtDq4fbrJ',
'quantity' => 2,
],
],
'mode' => 'payment',
]);

what type of data i have to pass so that stripe knows this session is for existing user only ?

hearty wolf
#

if you use mode payment, then it's for a one-time payment

#

if you use mode subscription, then it's for a subscription

sonic laurel
sonic laurel
hearty wolf
#

yes

sonic laurel
#

one thing need to know

hearty wolf
#

sure

sonic laurel
#

will stripe return any post or get data under success url ?

#

because after the success I we also need to store data on our local database

hearty wolf
#

it's best not to rely on the success URL but rather use webhooks

sonic laurel
#

or any other way i have to sync data with stripe

hearty wolf
sonic laurel
#

please correct me if I am wrong

according to the documents :

when the session is complete we have to use the web-hooks based on the session event.

checkout.session.completed This returns the whole recently created subscription data and we can easily save the subscription data on our local database

#

@hearty wolf

hearty wolf
#

yes that's correct