#altairsama2_api

1 messages ยท Page 1 of 1 (latest)

fresh oliveBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293178225933029386

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

jagged atlas
undone terrace
#

๐Ÿ‘‹ happy to help

jagged atlas
#

hey, appreciate it!

undone terrace
#

if you pass a customer ID and you set this parameter then it will be attached to the customer you've passed

jagged atlas
#

I just tested this out, the method wasnt attached, was it because of setting it as off_session?

undone terrace
#

would you mind sharing the Checkout Session ID?

jagged atlas
#

I only found the intent id pi_3Q7bShDaD6OoIhpK1K3Ve1Q7 and while its logged here that the payment method is saved, if I try to create an invoice from the dashboad, no saved card pops up

undone terrace
#

attaching a payment method to a customer and making the default for invoicing is 2 different things

jagged atlas
#

but if in the dash itself, the payment method is not working,

undone terrace
#

just hold on a second

jagged atlas
#

then auto pay would not work right?

undone terrace
#

the Checkout Session you shared doesn't have any customer

fresh oliveBOT
jagged atlas
#

hey, my bad, I just checked, while the session succeeded, the customer wasnt saved

#

I think it was because of temp mail in the session, I didnt create a cust id for that email

undone terrace
#

you need to create the customer first then pass its ID to the Checkout Session

jagged atlas
#

for an onboarded customer this worked perfectly, thanks

jagged atlas
drifting totem
#

hi! I'm taking over this thread.

#

let me know if you have other questions.

jagged atlas
#

there's just subscription id only

drifting totem
jagged atlas
#

ah, my bad, thanks!

jagged atlas
#

hey, please let me know if you would prefer for me to create a new thread, but do I need to store the payment method id on my end if we set setup_future_usage to true when creating a checkout session?

drifting totem
#

you can ask your question here.

jagged atlas
#

because I tried to pay an invoice automatically

invoice_item = stripe.InvoiceItem.create(
        customer=stripe_customer.customer_id, price=stripe_product.default_price.id
    )

    inv = stripe.Invoice.create(
        auto_advance=True,
        collection_method="charge_automatically",
        customer=stripe_customer.customer_id,
        pending_invoice_items_behavior="include",
    )
    resp = stripe.Invoice.finalize_invoice(invoice=inv.id, auto_advance=True)

    resp_2 = stripe.Invoice.pay(invoice=inv.id)
drifting totem
#

but do I need to store the payment method id on my end if we set setup_future_usage to true when creating a checkout session?
it depends what you are trying to do exactly.

jagged atlas
#

and this failed because no default payment method

jagged atlas
#

with a stored payment method

#

from setup_future_usage

drifting totem
#

yuo probabbly want to set the PaymentMethod as the default one for the customer, this way it will be automatically used to pay for Invoices

jagged atlas
#

can we do that in the checkout session itself?

jagged atlas
#

or would you recommend for us to store the payment method id on our end?

#

ah, so when the checkout session complete event handler is sent

#

we get the payment id

#

and store it?

drifting totem
#

yes, or you set it as the default payment method for the customer (as explained above) so it will be used automatically

jagged atlas
#

get checkout session event, get pm id

#

and then an extra api call to actually store it as default?

jagged atlas
drifting totem
#

yes looks correct to me

#

I recommend testing all of this is testmode first to make sure it works as expected

jagged atlas