#juice-transfer-error

1 messages · Page 1 of 1 (latest)

stoic sluiceBOT
delicate ingot
indigo laurel
#

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

delicate ingot
#

this is the id that i am passing: 63cff39eef2b51295ff6b395

indigo laurel
#

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"?

delicate ingot
#

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

indigo laurel
#

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?

delicate ingot
#

1 sec

#

this is where I am at. i added the definitions you mentioned

indigo laurel
#

I won't open a google docs like this

delicate ingot
#

1 sec

indigo laurel
#

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

delicate ingot
#

oh i think i see the issu

#

ok i was passing in the id of something else

indigo laurel
#

yeah that would be the issue

delicate ingot
#

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

indigo laurel
#

I'm sorry but you're dumping walls of text on me at this point

#

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)

delicate ingot
#

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?

indigo laurel
delicate ingot
#

1 sec

#

do you mind giving me a hint? the website is huge. not sure where you are pointing me to

indigo laurel
#

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

delicate ingot
#

i dont see any code for anything though

indigo laurel
#

does that make sense?

delicate ingot
#

kinda. let me read over this

indigo laurel
#

sure!

delicate ingot
#

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?

indigo laurel
#

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

delicate ingot
#

I will rewrite it

indigo laurel
delicate ingot
#

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..

indigo laurel
#

I'm sorry but this is a wall of text 😅

delicate ingot
indigo laurel
#

You really should be able to explain your flow in like 2 sentences at best.

delicate ingot
#

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^^

indigo laurel
#

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

delicate ingot
#

i am the person that got hired by the developer that could not do it

lunar cradle
delicate ingot
#

can i have your email @lunar cradle

lunar cradle
delicate ingot
#

?

#

I am crealy articulating the issue and what I am doing, literally line by line

lunar cradle
#

The support portal is the way to email in your questions and get assistance

delicate ingot
#

1 sec and i will rewrite it here

lunar cradle
#

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.

delicate ingot
#

1 sec

#

i am writing it out

lunar cradle
#

Failing requests or specific examples of unexpected behaviour are most helpful

delicate ingot
#

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

lunar cradle
#

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

delicate ingot
#

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

lunar cradle
#

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.

delicate ingot
#

not sure what u mean by "request ID"..... but this is the account.id = acct_1MTo3U4JzdkAys4y. is that what you wanted?

delicate ingot
#

req_voel1YedzxYPj4

lunar cradle
#

That's a successful charge request using the account debit approach

delicate ingot
#

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

lunar cradle
#

OK, and what part of that are you having trouble with?

delicate ingot
#

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?

lunar cradle
#

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

delicate ingot
#

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

lunar cradle
#

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

delicate ingot
#

ohhh i think i see

#

so let me ask u this

lunar cradle
delicate ingot
#

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

lunar cradle
#

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.

delicate ingot
#

Ok

#

How do I hold the funds transferred until they are verified

#

Is that even possible?

lunar cradle
#

What does verified mean? YOu choose when to create the transfer, so you can wait until any signal you prefer.

delicate ingot
#

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

warped sail
#

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.

delicate ingot
#

1 sec

#

Ok I think I understand

delicate ingot
#

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?

warped sail
#

Your Stripe balance holds funds until you choose to Transfer them or pay out to your bank

delicate ingot
#

Nooo

#

Before that

warped sail
#

What do you mean? There is no "before that". The funds are paid to you, they immediately go into your Stripe account balance

delicate ingot
#

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?

warped sail
#

Yup. Aside from the Stripe balance, there is no other mechanism for doing this

delicate ingot
#

The stripe balance for the buyer or seller or lead axis?

warped sail
#

Not sure what that means

delicate ingot
#

What is the stripe balance

#

Does each customer have a stripe balance?

warped sail
delicate ingot
#

Ok that’s what I though

#

So each connect account can have a balance

#

So the question reminds

warped sail
#

Which question?

delicate ingot
#

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?

warped sail
#

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

delicate ingot
#

Sweet!!

#

How do I put it on the platform?

warped sail
delicate ingot
#

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?

warped sail
#

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

delicate ingot
#

Ok sweet!!!!!!ur the best

#

Let me see

#

So which one can I for sure do from the platform, to any connect account

#

1 sec

#

R u sure?

#

Destination charge does not look like what I am looking for

#

Can u send me a screen shoot of what section ur looking at