#juice-transfer-error
1 messages · Page 1 of 1 (latest)
im trying to follow this guide: https://stripe.com/docs/api/transfers/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
juice-transfer-error
Hey @delicate ingot this error seems to show that you are passing something that isn't a string where we expect it. I assume that stripeBankAccount._id is not what you think. Try printing it out first
this is the id that i am passing: 63cff39eef2b51295ff6b395
I'm fairly sure you aren't passing that id. Also that id means nothing to Stripe, it's not a Stripe id. Also the destination for a Transfer is supposed to be a connected Account id acct_123
Let's take a step back because you might have mixed up many different things together here. Please explain what you are really trying to do. Where are the funds coming from? What is "a customers account"?
i was told to this by toby
1 sec
I did what you asked me to do, i redid the question with a lot of detail. now I am able to generate the charge against an account. now i need to transfer funds to a customer account. let me get a small write up together really quickly
Just to make things super clear:
- A Customer represents a person paying for a service. John Doe buying a cookie for $9.99
- An Account represents an entity (individual or company) providing a service and being paid for it. Cookie Factory is a business selling cookies for $9.99
- A Platform helps facilitate payments between a Customer and an Account
@delicate ingot did that help? Do you have more details?
I won't open a google docs like this
1 sec
We're already talking in real time here and I explained the vocabulary above. You need to pass destination: 'acct_123' where this is the id of a connected account representing the business/entity you're accepting payments for
yeah that would be the issue
ok im getting really really close here
I am getting the following error:
error: Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number.
not sure the logic of how i did everthing makes sense
how can i share the google doc with you?
i guess I can type it out
do you have an email i can send this to
this is my whole summary:
.
Hello,
I been having some issues integrating with stripe. So i made my requirements a bit more clear
Below are the goals for integrating stripe with our system:
1-Ability to collect customer financial information to purchase goods (credit card, checking etc)
2-Ability to pay account for goods sold
2-Ability to charge customers without needing to confirm or approver transactions, the system should do this
Our system works like an auction house.
This is not like ebay or amazon where you list the product you want to sell and people place purchases.
The system works more like the stockmarket.
Users send a ping to our system with the data they want to sell..
Below is the high-level mechanism of how the buying/selling takes place.
This is where I am in the process:
PART 1
I think that the code below is used for collecting a users bank information so that they can pay for goods. If this is not correct please let me know
// code sample is for node.js server
exports.createStripeBank = async (req, res, next) => {
console.log("createStripeBank() API HIT");
let customer = await getCustomer(req.userData)
if (customer == null) {
customer = await createCustomer(req.userData)
} else {
console.log('no customer created')
}
const account = await stripe.accounts.create({ type: 'express' });
createStripeBankAccount({ userId: req.userData.userId, stripeBankId: account.id })
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'http://localhost:4200/settings',
return_url: 'http://localhost:4200/settings',
type: 'account_onboarding',
});
res.status(201).json({
url: accountLink.url
})
};
async function createStripeBankAccount(obj) {
const stripeBank = new StripeBankAccount({
createdAt: Date.now(),
lastUpdate: Date.now(),
creator: obj.userId,
stripeBankId: obj.stripeBankId
});
stripeBank
.save()
}
PART 2
Now that the users bank info has been saved, i need a flow to create a charge against their bank account. If this is not correct, please let me know
charge = await stripe.charges.create({
amount: 1500,
currency: "usd",
source: account.id,
description: `Campaign id is${campaignId}. Campaign name is ${description}`
});
PART 3
Now i need to transfer funds to the account that sold the goods ( for this example, the account that sold and bought the goods is the same)
const transfer = await stripe.transfers.create({
amount: Number(req.body.amount),
currency: 'usd',
destination: account.id,
});
I get the following error:
(node:13658) UnhandledPromiseRejectionWarning: Error: Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number.
thats what I told toby, he told me to create a charge the way I show in step 2.
but now I am in the last step and i get the funds error. which is weird because thats where the funds should be
I'm sorry but you're dumping walls of text on me at this point
But your original question is really easy to solve. You haven't carefully read the docs. You need to read https://stripe.com/docs/connect/charges-transfers#transfer-availability specifically
also part 1 doesn't make sense to me at all. You talk about collecting bank account details for a customer to pay for a service. But your entire code is creating a connected account (where they will receive money not pay for a service)
wtf i was told something else.
i had the code for collecting a payment before and I was told to use connect so now I am super confused.
so i lets get back to level 1 i guess... i really though i was almost done here....
How do i collect bank acocunt detals for a customer to pay for a service?
1 sec
do you mind giving me a hint? the website is huge. not sure where you are pointing me to
I am pointing you to the one canonical end to end doc for accepting payments from a customer's US bank account, which seems to be exactly what you are trying to do
i dont see any code for anything though
ah sorry, I expected you to read this, understand it and then see https://stripe.com/docs/payments/ach-debit/accept-a-payment which is right below 😅
does that make sense?
kinda. let me read over this
sure!
so if I am reading this correctly, this code will ask the user for their bank account to PAY for an item RIGHT THEN. which is not what I am looking for.
am i reading that right?
yes.
I'm sorry but despite all this back and forth I still have no idea what you are trying to do at this point. This should be possible to explain in 2 sentences without needing an entire google doc for it
I will rewrite it
@delicate ingot do you have more details? If not, I think you would be better off working with our support team directly at this point https://support.stripe.com/contact
Website: lead axis
Goal: lead axis allows customers to sell data among each other
Sign up process::
Customer creates an account
Bank information to pay for goods purchases
Bank information to receive money for data sold
Create a seller account
Indicate what type of data you are selling
Create a buyer account
Indicate what type of data you want to buy
Bidding process:
Our system works like an auction house.
This is not like ebay or amazon where you list the product you want to sell and people place purchases.
The system works more like the stockmarket.
This is how the process works:
Seller sends lead axis the following information:
Hi, I want to sell 50k records of white males in florida that have diabetes
Does any one want to buy this data?
Lead axis performs a API call to customers and ask them if they want to submit a bid for the data.
Each customer has 5 seconds to respond with the price they are willing to pay for the data
Note: the customers system is configured to submit a bid depending on a set of conditions. These conditions can be something simple as ‘always buy the data on thursdays and fridays’ or something more complex.
Lead axis waits until all the customers reply with a bid to buy or not
Lead axis picks the highest bider and charges them the amount they bought the data for.
Users send a messaged to our system with the data they want to sell..
I'm sorry but this is a wall of text 😅
You really should be able to explain your flow in like 2 sentences at best.
I am
i tried explaining it soooo many times
i can send it to your email
there is a miscomunication here i cant figure out
i wrote out my story and did a diagram
i know i am like 1 or 2 steps away from achiving my goal
that looks better^^
oh i remember you
you said the same thing yesterday, that it was urgent and needed to be done by Wednesday 😅
Really, at this point, you need to hire a professional freelancer and they will build this for you
I have to run but my colleague @lunar cradle is taking over
i am the person that got hired by the developer that could not do it
If you can clearly articulate those exact issues, ie example SDK or API calls not doing what you expect then we can take a look, but it sounds like you might have broader integration issues to address
can i have your email @lunar cradle
You can write in to support explaining your use case and open questions using our support portal: https://support.stripe.com/contact
The support portal is the way to email in your questions and get assistance
1 sec and i will rewrite it here
You've shared some requirements and steps, but not the issues you're having in translating those steps to your Stripe integration code
Unfortunately I cannot help you to interpret general requirements like that -- you're going to need to be very specific about the issues you're having with the Stripe API/SDK in order for us to be able to help here.
Failing requests or specific examples of unexpected behaviour are most helpful
PART 1
I think that the code below is used for collecting a users bank information so that they can pay for goods. If this is not correct please let me know.
exports.createStripeBank = async (req, res, next) => {
console.log("createStripeBank() API HIT");
let customer = await getCustomer(req.userData)
if (customer == null) {
customer = await createCustomer(req.userData)
} else {
console.log('no customer created')
}
const account = await stripe.accounts.create({ type: 'express' });
createStripeBankAccount({ userId: req.userData.userId, stripeBankId: account.id })
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'http://localhost:4200/settings',
return_url: 'http://localhost:4200/settings',
type: 'account_onboarding',
});
res.status(201).json({
url: accountLink.url
})
};
async function createStripeBankAccount(obj) {
const stripeBank = new StripeBankAccount({
createdAt: Date.now(),
lastUpdate: Date.now(),
creator: obj.userId,
stripeBankId: obj.stripeBankId
});
stripeBank
.save()
.then(createdStripeBank => {
})
.catch(error => {
console.log('error', error)
res.status(500).json({
message: "Creating a stripe bank account failed!"
});
});
}
PART 2
Now that the users bank info has been saved, i need a flow to create a charge against their bank account. If this is not correct, please let me know
charge = await stripe.charges.create({
amount: 1500,
currency: "usd",
source: account.id,
description: `Campaign id is${campaignId}. Campaign name is ${description}`
});
PART 3
Now i need to transfer funds to the account that sold the goods ( for this example, the account that sold and bought the goods is the same)
const transfer = await stripe.transfers.create({
amount: Number(req.body.amount),
currency: 'usd',
destination: account.id,
});
I get the following error:
(node:13658) UnhandledPromiseRejectionWarning: Error: Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number.
ignore *5
that says: Users send a message to our system with the data they want to sell
Ok so 1/ I can't validate code for you. If it's doing what you expect then great. If not, we can perhaps help guide you.
Now that error is something I can look at, one sec
the thing is that i am not sure
everytime i talk to you guys i am told something somewhat different
so i need to check everything
thats why i put a little note on there, because I litteraly not sure about any of this
Can you share the request ID where you get that error?
Note that if you use automatic payouts, you'll never have available balance to transfer, it gets allocated for the next automatic payout.
If you need to transfer like this you should either:
1/ Use source_transaction to point to the charge where the balance is coming from and is still pending
See here: https://stripe.com/docs/connect/charges-transfers#transfer-availability
or, 2/ switch to manual payouts so that balance accumulates in your account for use with transfers. You'd then create your own payouts manually when you have funds beyond the needs for your transfers.
not sure what u mean by "request ID"..... but this is the account.id = acct_1MTo3U4JzdkAys4y. is that what you wanted?
That's a successful charge request using the account debit approach
right
so that like ' a good was sold'
now i want to give 90% of the money to the seller, and lead axis keeps 10%
also
the money should go to lead axis for at least 5 days or until the data purchases releases the funds.
is that possible
OK, and what part of that are you having trouble with?
i am not sure that the code i wrote will work for what i described.
well i shared the error that i am having .
to answer your previous question:
Can you share the request ID where you get that error?
Note that if you use automatic payouts, you'll never have available balance to transfer, it gets allocated for the next automatic payout.
---ANSWER: ideally i would like to hold the payments in some sort of way OR the funds can go to lead axis, and then send it to them later
If you need to transfer like this you should either:
1/ Use source_transaction to point to the charge where the balance is coming from and is still pending
See here: https://stripe.com/docs/connect/charges-transfers#transfer-availability
or, 2/ switch to manual payouts so that balance accumulates in your account for use with transfers. You'd then create your own payouts manually when you have funds beyond the needs for your transfers.
---ANSWER: I think i want to do manual since i need to keep the money until the goods are verified. what do you think? is there a guide for manual?
The same doc is the guide for charges & transfers. Note this is specified:
Must be configured to use manual payouts or a combination of automatic payouts and the source_transaction parameter to ensure the account has sufficient funds to cover the transfer
1 sec
1 sec
for:
const transfer = await stripe.transfers.create({
amount: 1000,
currency: "usd",
source_transaction: "{CHARGE_ID}",
destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
});
what is CHARGE_ID?
and what is CONNECTED_STRIPE_ACCOUNT_ID?
my best guess for CONNECTED_STRIPE_ACCOUNT_ID is::
const account = await stripe.accounts.create({ type: 'express' });
CONNECTED_STRIPE_ACCOUNT_ID = account.id this would be from the account giving the money
Yes, CONNECTED_STRIPE_ACCOUNT_ID is the connect account you instead to transfer funds to
CHARGE_ID is the charge associated with the payment you completed that you want to transfer some portion of
https://stripe.com/docs/connect/charges-transfers#transfer-availability
That's what's explained here
For example, if you just collected a card payment it would be here: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-latest_charge
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
when a good is sold for 10$,
I should generate a charge for 2$ then I should generate a transfer for 8$, so that I can make 20% profit. is that what you are suggesting?
also, is there any way to hold the funds for a set amount of time until the buyer can verify the goods?
So i see that they kinda have what i mentioned, but instead of a charge its a payment intent
When using separate charges and transfers, you completely control when the transfer is created/sent, so that timing is entirely up to you
Yes that's the payment bringing funds into your platform account. Charge and Payment Intent play the same role here.
Ok
How do I hold the funds transferred until they are verified
Is that even possible?
What does verified mean? YOu choose when to create the transfer, so you can wait until any signal you prefer.
1 sec
Like when u buy something from Amazon, u have 45 days to get a refund. So the buyer can verify the item they bought
Hi there 👋 taking over, as my colleague needs to step away
How do I hold the funds transferred until they are verified
Is that even possible?
This was answered in the previous message:
When using separate charges and transfers, you completely control when the transfer is created/sent, so that timing is entirely up to you
You have a Stripe balance. You choose to transfer from it when you want.
I have to take the moneys out of the buyer and put it somewhere for a while. how do I do that?
Does that make sense?
Your Stripe balance holds funds until you choose to Transfer them or pay out to your bank
What do you mean? There is no "before that". The funds are paid to you, they immediately go into your Stripe account balance
When a good is sold, I need to remove the money from the buyer, then I need to put that money somewhere until the buyer can verify that the seller good is valid. Does that part make sense?
Yup. Aside from the Stripe balance, there is no other mechanism for doing this
The stripe balance for the buyer or seller or lead axis?
Not sure what that means
Ok that’s what I though
So each connect account can have a balance
So the question reminds
Which question?
When a good is sold, I need to remove the money from the buyer, then I need to put that money somewhere until the buyer can verify that the seller good is valid. Can I do that with stripe?
Yup. You can let it sit in the Stripe account balance. Either the balance on the platform account or the balance on the Connect account
Ohhhh. So I can just do a regular charge to put it on the platform?
Ok that makes sense
Is that right?
If yes, then how do I move from the platform to a connect account?
That's right. Then you can create Transfers. Or you can use something like Destination Charges (mentioned in the above doc) to automatically transfer the amount of the charge to the Connect account