#frabor98-connect-transfer
1 messages · Page 1 of 1 (latest)
Hello
Here's my code in Node.js: const transfer = await stripe.transfers.create({
amount: amount.toFixed(2) * 100,
currency: 'EUR',
destination: riderStripeAcc,
description: 'Transfer relativo a ordini: ' + ids,
metadata: {
riderId: riderId
}
});
You can use "Bypass pending balance" test cards, so that it will bypass pending stage and make the fund available for transfer: https://stripe.com/docs/testing#available-balance
Thanks, can you please tell me what lines I have to add to my code?
Should I put "payment_method: pm_card_bypassPending"?
Hi! I'm taking over this thread.
Hello
The error balance_insufficient means you don't have enough fund in your available balance to make the transfer. If you want to increase that balance in test mode, you can create some payment with the test card 4000000000000077 (or pm_card_bypassPending), that will automatically add the funds to your pending balance.
ok, so in the code I pasted up I have to put "payment_method: pm_card_bypassPending"?
no, the code you pasted is doing a transfer, and that doesn't accept a payment_method parameter.
Instead you should create a new PaymentIntent to add funds to your available balance. Something like this:
const paymentIntent = await stripe.paymentIntents.create({
amount: 10000, // value to change
currency: 'EUR', // value to change
payment_method: "pm_card_bypassPending",
confirm: true
});
Note that pm_card_bypassPending will only work in test mode.
So with you code I add money to my test env, then with my code I can test the transfer?
yep exactly!
In both test and live mode, when a payment is made, the funds go to your pending balance. Then you have to wait a few days for the funds to move to your available balance.
https://stripe.com/docs/connect/account-balances
The charged amount, less any Stripe fees, is initially reflected on the pending balance, and becomes available on a 7-day rolling basis. (This timing can vary by country and account.)
Ok, so I have done right now a 100 euro recharge. have I to wait a few days to test transfer?
If you used pm_card_bypassPending, the funds are automatically moved to your available balance, so no need to wait.
I just created a paymenth intent but i still get no funds
{
id: 'pi_3LE7hjFhAZG47AU10Tps8chS',
object: 'payment_intent',
amount: 100,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 100,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
charges: {
object: 'list',
data: [ [Object] ],
has_more: false,
total_count: 1,
url: '/v1/charges?payment_intent=pi_3LE7hjFhAZG47AU10Tps8chS'
},
client_secret: 'pi_3LE7hjFhAZG47AU10Tps8chS_secret_etQookbnG4fQQMESEGCDsTCJY',
confirmation_method: 'automatic',
created: 1656058647,
currency: 'eur',
customer: null,
description: null,
invoice: null,
last_payment_error: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: 'pm_1LE7hjFhAZG47AU170SAN3j1',
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: 'automatic'
}
},
payment_method_types: [ 'card' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'succeeded',
transfer_data: null,
transfer_group: null
}
This PaymentIntent has amount: 100, so it added 1€ to your available balance. Is this enough to do your transfer? If needed you can check your available balance with https://stripe.com/docs/api/balance/balance_retrieve
Maybe I have to amount * 100?
If you want to add 100€, then yes
It works! Thanks