#suraj-patidar_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/1410536222736121856
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- suraj-patidar_webhooks, 13 hours ago, 8 messages
- suraj-patidar_webhooks, 19 hours ago, 18 messages
- suraj-patidar_webhooks, 22 hours ago, 9 messages
- suraj-patidar_webhooks, 23 hours ago, 14 messages
๐ happy to help. will be with you shortly
thank you
since you're creating a Direct Charge the Customer you should be referencing should exist on the Connected Account, whereas the one you shared is created on the Platform account
if you want to save the customer and their payment information on the platform to be able to share them across your connected accounts you need to clone the customer and their payment method on each connected account whenever you're doing the direct charge
this doc explains it in more details
https://docs.stripe.com/connect/direct-charges-multiple-accounts#clone-payment-method
I'm not sure I understand
if create payment method with that stripe connect account then in checkout session which thing i need to pass ?
the customer ID from the connected account
and the PaymentMethod ID for that customer
so first i need to create payment intent for that customer and connected account and then pass this id in checkout for charge right ?
i want to create checkout for direct charge
so if client pay anything it direct save in connected account
so how i can achieve this ?
where do you want to store the customer information?
at the level of the Platform?
stripe_account = marina.stripe_account
stripe_customer = Customer.objects.filter(subscriber=user_obj).first()
if not stripe_customer:
stripe_customer = Customer.create(subscriber=user_obj,)
user_obj.stripe_customer = stripe_customer
user_obj.save()
session = stripe.checkout.Session.create(
expires_at=int(time.time())
+ settings.STRIPE_CHECKOUT_SESSION_EXPIRE,
payment_method_types=["card"],
line_items=[
{
"price_data": {
"currency": "usd",
"product_data": {"name": "Booking"},
"unit_amount": invoice_obj.total,
},
"quantity": 1,
},
],
metadata={
"user_id": f"{user_obj.id}",
"marina_master_id": f"{marina.id}",
"invoice_id": f"{invoice_obj.id}",
"type": "one_time_payment",
},
payment_intent_data={"setup_future_usage": "off_session"},
mode="payment",
success_url=f"{prefix}{settings.NEXT_PUBLIC_BOATER_PORTAL}/payment/success",
cancel_url=f"{prefix}{settings.NEXT_PUBLIC_BOATER_PORTAL}/payment/failed",
stripe_account=stripe_account.id,
)
Session.sync_from_stripe_data(session)
i did this
do you want to be able to share that information across your connected accounts?
i want to save customer infoarmtion direct in connected account
but give me both soulation how i can achive and what steps i need to do
if you don't care about the customer information being shared, you need to follow this guide https://docs.stripe.com/connect/direct-charges?platform=web&ui=stripe-hosted
otherwise you need to follow the guide I sent you earlier
for first option then in checkout i don't need to include customer id right ?
stripe._error.InvalidRequestError: Request req_wpQy5cA7HSWmHe: Invalid integer: 209.30
?
the unit amount should be in cents
so basically if you want to charge 209.30USD then the amount should be 20930
okay
you can, but this needs to be an existing customer on the connected account in question
session = stripe.checkout.Session.create(
expires_at=int(time.time()) + settings.STRIPE_CHECKOUT_SESSION_EXPIRE,
payment_method_types=["card"],
line_items=[
{
"price_data": {
"currency": "usd",
"product_data": {"name": "Booking"},
"unit_amount": invoice_obj.total,
},
"quantity": 1,
},
],
metadata={
"user_id": f"{user_obj.id}",
"marina_master_id": f"{marina.id}",
"invoice_id": f"{invoice_obj.id}",
"type": "one_time_payment",
},
payment_intent_data={"setup_future_usage": "off_session"},
mode="payment",
success_url=f"{prefix}{settings.NEXT_PUBLIC_BOATER_PORTAL}/payment/success",
cancel_url=f"{prefix}{settings.NEXT_PUBLIC_BOATER_PORTAL}/payment/failed",
stripe_account=stripe_account.id,
)
this work or not ?
it works but this means each time there's a new customer that will be generated
a different one
for cent is work like that all currency like if usd or eur i need same total *100 right ?
int(total * 100)
yes
you can see the minor units of each currency here https://docs.stripe.com/currencies#minor-units