How to make custom payment to a customer - stripe-payments

I am looking for a way to make payment to a customer like a business do.
for eg. a business will ask you to fill the form with bank name, acoount number IFSC code etc.
so customer can receive a payment.
I have user who is having a digital wallet with some amount.
I want to transfer the amount to user's provided bank account on the request.
I saw stripe documentation but I am not sure if stripe support custom payment.
Stripe provides refund as per below method where I have to provide charge id string
and because of charge id stripe will refund only the amount which was charged earlier and this is linked to particular charge only.
const stripe = require('stripe')('your_stripe_key');
const refund = await stripe.refunds.create({
charge: 'charge_id_string',
amount: 100,
});
I want to make custom payment/refund so I can transfer users wallet available balance to bank account.
Any suggestion will be appreciated.

I don't think you should use Refund because you can only create a refund based on an existing charge.
You should probably look at Transfer, which allows you to send funds from your Stripe account to a connected account. In your use case, you should create a connected account for your customer so that you can transfer refunds to your customer and eventually payout to their bank account.
Visit here to learn more about Stripe Connect.

Related

Taking fee and payment reservation Stripe

Pretty new to Stripe, we're building an online marketplace. Each user can buy assets from any other user. We also take fees for each payment.
We go with connected accounts. Seller goes through the onboarding flow (create connected account, create account link etc), while buyer is registered as a customer of our platform on Stripe.
Now, whenever buyer makes a payment we create a payment intent to pay to us (amount + 20% fee via):
stripe.paymentIntents.create(params)
Then we create new payout to seller (amount) using source transaction from payment intent above:
await stripe.transfers.create({
amount: payment.amount * 100,
currency: payment.currency,
destination: seller.stripeAccountId,
source_transaction: sourceTransaction,
});
Is this the preferred and best way of handling this? In terms of time, we need first to wait for payment to settle to our bank account to be able to payout seller?
Is there any better way of doing this instead of manual payouts?
Is there a way to make direct transfer to connected account when user does payment?
I tried with payment intent, specifying connected account id in request, but API is complaining that customer id is on our platform but account id is specified, so it's not possible obviously.
Also, manual payouts would come handy to simulate payment escrow/deposit. When user create a request for some asset, we would immediately transfer certain amount to our account, like reserving that amount. And if the seller accepts the offer, we would do a payout. If seller rejects the offer, we would do payout to the buyer, giving him back his money.
Does this make sense?
Thanks in advance
You don't need Payout (yet) in your use case. You are doing Separate Charges and Transfers, and fund simply moves from your Account's balance to Connected Account's balance. It hasn't been out of your Connected Account's balance to your Connected Account's bank account yet, which is called "Payout".
In another word, Payout is separated process than Charges and Transfers. Charges and Transfers can happen immediately, and Payouts normally happen later on a daily basis or manually.
Find more explanation on Connect Balance.
There is also Destination Charge which is simpler than Separate Charges and Transfers. I recommend Destination Charge unless you have specific reason to use Separate Charges and Transfers, ie. you need to transfer to multiple Connected Accounts on one payment.

Charging customer with saved card in main account with connected account in Stripe

I know I can save a card with a customer in Stripe and use it for later. My question is can I save the customer with the card on the main Stripe onboarding account and use that customer for all sub accounts (connected accounts). Or does the customer have to be created and saved on each connected account to work.
Stripe Payment: Save token and customer and make payment later from token
Stripe connected accounts would need to have copies of those customers and cards associated with their accounts to be able to process charges for those cards/customers.
There are ways to copy payment methods from the Platform to the Connected account that are detailed here which you might find useful.

Stripe sending money to user bank account

I have built application that similar to to freelancer marketplace. I want to when user earn money thorugh my marketplace. A buyer only can pay using their card, which is already implemented with stripe
and a seller should be able to withdraw their money to direct their bank. But i didn't notice such a feature on the stripe.
I notice stripe refund method to refund funds, which i dont want, coz, i am not going to refund money to any user buyer. I just want to send the seller bank account directly from my stripe account
How can i do it?
I notice this, but i dont want it all
charge = await stripe.charges.refund(charge.id, {
amount: 1000
});
You need to read about Connect, Stripe's product to help you build marketplaces like you describe. Your seller would have a connected account and you'd send them money with payouts.

Stripe payment and bank account

Is it possible with Stripe to perform a test transaction to ensure that an account is funded?
I would like to :
take the Credit Card ID at the moment of the booking (but no payment at that moment)
make the customer pay AFTER the service has been done
What you likely want is to place a hold on the card for the given amount, and then capture the funds later after the service has completed. When placing a hold the given amount is authorized and guaranteed by the cardholder's bank. You'll often see these types of transactions show up on your online bank statement when renting a car or when checking-in to a hotel room. When processing your payment with Stripe you would set the capture_method on the PaymentIntent to manual which tells Stripe to only authorize the given amount. Then, once the service is rendered you would capture the funds. The following guide covers the approach in detail:
https://stripe.com/docs/payments/capture-later

Xero Workflow and payment accounts when creating paid invoices via API?

I'm trying to work out the correct method of attributing payments on invoices that are automatically created after a user purchases something on site, payment handled by Stripe (or other payment gateway). Here is the current flow from user action to Xero interaction (all working fine):
User purchases membership on site
Payment is processed by Stripe on-site
If payment is successful, an Invoice is generated in Xero (and a contact if it doesn't exist)
Payment is added to the invoice immediately after it is generated, and it's status is set to Paid.
Paid invoice is emailed to new member from Xero
Stripe deposits money in nominated business account each day
I have two questions about this workflow
What is the normal practise for dealing with PaymentAccount when applying a payment? Should we create a new payment account just for Stripe? A new "Bank" account for Stripe? The context of this question is selecting the correct PaymentAccount ID for the payment when creating the invoice.
Will reconciliation still be possible for these paid invoices when Stripe sends payments (assuming they send itemised payments)? Even if the money is deposited in a different (Real) account integrated in Xero?
Thanks
Your questions about stripe are more appropriate in Xero forums, since they are bookkeeping questions not API qestions.
Stripe can provide a bank feed to Xero, and you should set this up.
This means you have a Stripe bank account, which is the therefore the payment account. Payment reconcilations are easy (but can't be done via API).
The actual deposit of real money into a real bank account will be a consolidated amount typically called a 'settlement', typically one day of transactions, less fees, refunds and possible timing issues etc. The Stripe bank feed will have an entry for this. It is reconciled by a Xero user as a bank transfer between the Stripe bank and the real bank, and is nothing to do with the payment on the invoice.

Resources