#altairsama2_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
๐ happy to help
hey, appreciate it!
if you pass a customer ID and you set this parameter then it will be attached to the customer you've passed
I just tested this out, the method wasnt attached, was it because of setting it as off_session?
would you mind sharing the Checkout Session ID?
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
attaching a payment method to a customer and making the default for invoicing is 2 different things
no, I was trying to see if autocharge via api would work
but if in the dash itself, the payment method is not working,
just hold on a second
then auto pay would not work right?
the Checkout Session you shared doesn't have any customer
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
you need to create the customer first then pass its ID to the Checkout Session
for an onboarded customer this worked perfectly, thanks
yeah, this was the issue. appreciate the help
just one last thing, when trying to create an invoice, how do I link a product id with it? according to docs (https://docs.stripe.com/api/invoices/create), there's no option to pass in a product id?
there's just subscription id only
I recommend checking this guide that explains how this works: https://docs.stripe.com/invoicing/integration/quickstart
ah, my bad, thanks!
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?
you can ask your question here.
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)
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.
and this failed because no default payment method
I want stripe to auto pay invoice
with a stored payment method
from setup_future_usage
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
can we do that in the checkout session itself?
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?
yes, or you set it as the default payment method for the customer (as explained above) so it will be used automatically
but the flow will be same right?
get checkout session event, get pm id
and then an extra api call to actually store it as default?
also this flow is how its supposed to be right? if we want immediate payment on inv creation
yes looks correct to me
I recommend testing all of this is testmode first to make sure it works as expected
will do, thanks, really appreciate the help!