#deepesharora

1 messages · Page 1 of 1 (latest)

compact plankBOT
wanton mirage
#

hi @gentle plover can i add a colleague here too?

gentle plover
#

Sure

wanton mirage
#

I have first created a subscription object...that gave me the invocie

#

can you point me how to associate the subscription & payment intent to each other?

#

basically i'm expecting that the customer hits "subscribe" to something on our website and we create a subscription object and then get to them to stripe so they enter their cc information and pay

#

i hope that makes sense...if there is a step by step doc, i'm happy to follow it and ping you if I'm stuck. So happy to have your help 🙏

#

how do i add another person to this thread? any idea?

gentle plover
#

If the subscription you created requires a payment (i.e. there's no trial or 100% discounts being applied) then subscription creates an invoice which you can look at by looking up latest_invoice on the subscription object

latest_invoice should give you an invoice object which then should have a PaymentIntent linked to it.

#

You can just mention them using @

wanton mirage
#

i have a latest_invoice object yes. how do i take the payment intent and pass it to the user so they interact with it?

gentle plover
#
wanton mirage
#

ok chcking

#

by any chance would you have sample code on building a full subscription integration? ...ie which steps shoudl we follow and in what order? crate subscription first or payment intent first? is there a best practice @gentle plover

#

i want to do this the correct and scalable way....

gentle plover
wanton mirage
#

ok. i'll take few minutes...can i message you within few minutes or will this thread close automatically?

#

i'm going to try a few things

#

this is helpful i think

gentle plover
#

I can keep it open for a bit 👍

wanton mirage
#

ok thank you so much my friend. I think you've shown me the way. now i just need to hack around a bit to see if i get it right 🙂

#

i was being blind....

your current coumentation says...
On the backend, create the subscription with status incomplete using payment_behavior=default_incomplete. Then return the client_secret from the subscription’s first payment intent to the frontend to complete payment.

suggestion ...
what will help is if you guys modify this sentences in your guide to talk about expanding the latest_invoice to get the payment_itnet attached to the subscription

#

i'm trying again

gentle plover
#

I'll flag your feedback with our docs team and see if we can get it updated

wanton mirage
#

@regal hawk show the sub object we got

#

@gentle plover are we doing this right?

regal hawk
#
{
"id": "sub_1NSLKuHjXNLgtBFuHZyXnm7K",
"object": "subscription",
"application": null,
"application_fee_percent": null,
"automatic_tax": {},
"billing_cycle_anchor": 1689000312,
"billing_thresholds": null,
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null,
"cancellation_details": {},
"collection_method": "charge_automatically",
"created": 1689000312,
"currency": "usd",
"current_period_end": 1691678712,
"current_period_start": 1689000312,
"customer": "cus_OEoy4pc8kMbnvT",
"days_until_due": null,
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"ended_at": null,
"items": {},
"latest_invoice": "in_1NSLKuHjXNLgtBFujsYDDChq",
"livemode": false,
"metadata": [],
"next_pending_invoice_item_invoice": null,
"on_behalf_of": null,
"pause_collection": null,
"payment_settings": {},
"pending_invoice_item_interval": null,
"pending_setup_intent": null,
"pending_update": null,
"plan": {},
"quantity": 1,
"schedule": null,
"start_date": 1689000312,
"status": "incomplete",
"test_clock": null,
"transfer_data": null,
"trial_end": null,
"trial_settings": {
"end_behavior": {
"missing_payment_method": "create_invoice"
}
},
"trial_start": null
}
wanton mirage
#

is this correct...it says >>> "pending_setup_intent": null,

regal hawk
#

and trying to exapand it like this

            $subs_obj->id,
            ['expand' => ['latest_invoice']]
          );```
wanton mirage
#

@gentle plover LMK

gentle plover
#

Correct, pending setup intent is only generated for subscriptions with a trial (or with 100% discounts) where a payment isn't required up front.

wanton mirage
#

so i will get my payment intent only from the expand

#

?

gentle plover
#

Yes, PaymentIntnet is generated by the invoice

regal hawk
#

This is what I got when I executed the expand thing

wanton mirage
#

we dont want customer to get options for pay with link or cash app..we've turned those off but its still appearing on the payment link url >> see >>

gentle plover
regal hawk
wanton mirage
#

ok so it took the paymetn for $50 for this test and charged us 1.75 in fees
how do i know its setup to charge next month also and what will it charge me in fees next month?

gentle plover
gentle plover
wanton mirage
#

awesome! thanks so much @gentle plover
this was amazing help