#suraj-patidar_api

1 messages ยท Page 1 of 1 (latest)

iron kernelBOT
#

๐Ÿ‘‹ 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.

signal stream
#

๐Ÿ‘‹ happy to help. will be with you shortly

simple stump
#

thank you

signal stream
#

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

simple stump
#

in this i haven't show any checkout

#

related issue

signal stream
#

I'm not sure I understand

simple stump
#

if create payment method with that stripe connect account then in checkout session which thing i need to pass ?

signal stream
#

the customer ID from the connected account

#

and the PaymentMethod ID for that customer

simple stump
#

so first i need to create payment intent for that customer and connected account and then pass this id in checkout for charge right ?

signal stream
#

no

#

let's take a step back

#

what are you trying to achieve?

simple stump
#

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 ?

signal stream
#

where do you want to store the customer information?

#

at the level of the Platform?

simple stump
#
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

signal stream
#

do you want to be able to share that information across your connected accounts?

simple stump
#

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

signal stream
#

otherwise you need to follow the guide I sent you earlier

simple stump
#

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
?

signal stream
#

so basically if you want to charge 209.30USD then the amount should be 20930

simple stump
#

okay

signal stream
simple stump
#
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 ?

signal stream
#

it works but this means each time there's a new customer that will be generated

#

a different one

simple stump
#

for cent is work like that all currency like if usd or eur i need same total *100 right ?

int(total * 100)

signal stream
#

yes