#Hritik_9

1 messages · Page 1 of 1 (latest)

timid tideBOT
#

Hello! We'll be with you shortly. 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.

noble bison
#

Hi, let me help you with this.

radiant mirage
#

one more thing how i can withdraw remaining Invoice credit balance of customer

timid tideBOT
radiant mirage
#

see as customer point of view..
i have total 50rs in my credit balance
how i can withdraw these balance ?? to my respective bank account or via card

lucid wadi
#

The credit balance is positive, which means you owe that amount which would be added to the next finalized invoice and increase the amount due

#

Are you a developer?

radiant mirage
#

yes

#

see as a custome i have 50 and i want to withdraw this balance

#

how could i do that????

#

without createing each customer stripe acc

lucid wadi
#

Are you asking about the same customer in the previous screenshot? Did you read the description in the screenshot?

Balance will increase the amount due on the customer's next invoice.
This means your logic is incorrect, this is the amount customer owes
You can't withdraw the owed balance

radiant mirage
#

okay now the scenario is
customer will have to deposite money first & then he can use that money throught the website.
So for this ""i am depositing the money by checkout session api and creating customer credit balance .>>""

but i am stuck for withdraw the money.

#

so for other transaction i will only deduct the customer balance.. for showing purpose..
but for withdraw the rest amout ?? how he can withdraw

#

hope you get the scenario!!!

lucid wadi
radiant mirage
#

"You'll need to find the charge that you made using checkout session"-> but for creating charge we need to create paymentIntent ?
or how charge n all will work?

lucid wadi
radiant mirage
#

yes how i create a charge ?? for that customer??

lucid wadi
#

it is all automatically created with Checkout Sessions

radiant mirage
#

is the first step is correct ?? that taking money from customer by checkout session for mode payment .. because it can happen again and agaim

lucid wadi
#

is the first step is correct ?? that taking money from customer by checkout session for mode payment .. because it can happen again and agaim
Not sure what you mean by that.

are we talking about refunding existing balance or are we talking about "if customer adds more funds to their balance"

#

?

radiant mirage
#

yes .. this one and also taking money from customer that deposite !!

#

as its creating more and more entries

lucid wadi
#

I don't really grasp what you mean by more and more entries

Can you give a clear explanation of what APIs you're using in your flow and how exactly customer gets the credit balance?

radiant mirage
#

yes 1 min

#

$customer = $stripe->customers->create([
'name' => $userData->name,
'email' => $userData->email,
]);

            $topup= $stripe->customers->createBalanceTransaction($customer->id,
                      ['amount' => $depositAmount,'currency' => 'inr',]);


            $checkoutSession = $stripe->checkout->sessions->create([
                'success_url' => 'https://wordpress.betadelivery.com/prosperty-dev/my-wallet', // Define your success route
                'cancel_url' => 'https://wordpress.betadelivery.com/prosperty-dev/my-wallet',   // Define your cancel route
                'payment_method_types' => ['card'],       // Use 'card' for credit/debit card payments
                'mode' => 'payment',                      // Set mode to 'payment'
                'customer' =>  $customer->id,               // The customer's Stripe ID
                'line_items' => [
                 [
                'price_data' => [
                    'currency' => 'inr',            // Replace with your desired currency
                    'unit_amount' => $depositAmount, // Amount in the smallest currency unit (e.g., cents)
                    'product_data' => [
                        'name' => 'Deposit',         // Name for the deposit
                    ],
                ],
                'quantity' => 1,                    // Quantity is 1 for a single payment
            ],
        ],
    ]);

    // Redirect the user to the Checkout session
    return redirect($checkoutSession->url);

This is how i am creating balance and taking money from customer

lucid wadi
#

The logic is wrong though, you're creating a credit balance before even charging customer for it.

Additionally, you seem to be adding a positive $depositAmount in the customer balance which creates a credit but you should be creating a debit instead
https://stripe.com/docs/invoicing/customer/balance#credits-and-debits

Every customer has a credit balance. You can use this to issue a:

Credit adjustment—You owe the customer money.
Debit adjustment—The customer owes you money.

So ideally, you should accept the payment first using checkout sessions, then listen to checkout.session.completed webhook event to listen for when the payment process is complete then call createBalanceTransaction to add to customer's balance

radiant mirage
#

yes i respect your response i'll do this"So ideally, you should accept the payment first using checkout sessions, then listen to checkout.session.completed webhook event to listen for when the payment process is complete then call createBalanceTransaction to add to customer's balance"

just example understand the scenario...
after creating customer's balance .. how i can withdraw the total customer's balance ??

lucid wadi
#

When you say withdraw, are you asking how you'd send it back to the customer? OR are you asking how you as a merchant would be able to use these funds?

radiant mirage
#

how you'd send it back to the customer?
you got it correct now

lucid wadi
radiant mirage
#

but this is for specific payment intent correct ??
what if out of 50 he uses 25 and now 25 he want to withdraw

lucid wadi
#

You can do partial refunds

radiant mirage
#

So will it calculate from all total amountv ??

#

i can manage by customer credit balance .. while entering amount

but again one question if i paid 20$-20$-10$ total will be 50$ & i uses 35$ for 1-product
so my credit balance is 15 $ can i withdraw this 15$ ???

lucid wadi
#

You can't create unlinked refunds via the APIs we have available.
You'd need to create it based on the payments received as a merchant.

So in your example, you'll need send back $15 from one of those $20 payment intents

radiant mirage
#

ohh then what if these scenarios happen?

lucid wadi
#

You should talk to our support team to see if they have a way for you to refund any amounts without linking it to an existing charge/PaymentIntent. Unlinked refund is what you need

https://support.stripe.com/?contact=true

radiant mirage
#

yes does they have support phone number?

lucid wadi
#

All the options are listed on the page above

radiant mirage
#

okay very much thanks for the help

#

how i can save this thread

lucid wadi
#

You can find the thread using the search bar