#Hritik_9
1 messages · Page 1 of 1 (latest)
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.
one more thing how i can withdraw remaining Invoice credit balance of customer
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
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?
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
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
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!!!
You'll need to find the charge that you made using checkout session and refund the appropriate amount from there.
My colleague shared a support article outlining what you'd need to
https://support.stripe.com/questions/refunding-credit-balance-to-customer-after-subscription-downgrade-or-cancellation
Customer can't just withdraw customer credit balance like a wallet
"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?
When you use Checkout Sessions, it creates relevant PaymentIntent automatically
If you have a checkout session ID, you can retrieve it while expanding payment_intent property
https://stripe.com/docs/api/checkout/sessions/retrieve
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_intent
https://stripe.com/docs/api/expanding_objects
yes how i create a charge ?? for that customer??
it is all automatically created with Checkout Sessions
the linked payment intent should have latest_charge property you can expand
https://stripe.com/docs/api/payment_intents/object
is the first step is correct ?? that taking money from customer by checkout session for mode payment .. because it can happen again and agaim
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"
?
yes .. this one and also taking money from customer that deposite !!
as its creating more and more entries
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?
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
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
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 ??
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?
how you'd send it back to the customer?
you got it correct now
You'll need to find the checkout session that triggered createBalanceTransaction call to update the customer balance and then create a refund using the associated PaymentIntent
https://stripe.com/docs/refunds?dashboard-or-api=api
but this is for specific payment intent correct ??
what if out of 50 he uses 25 and now 25 he want to withdraw
You can do partial refunds
You can pass in amount
https://stripe.com/docs/api/refunds/create#create_refund-amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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$ ???
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
ohh then what if these scenarios happen?
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
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
yes does they have support phone number?
All the options are listed on the page above
You can find the thread using the search bar