#juice-payments-multiplequestions
1 messages ยท Page 1 of 1 (latest)
Hey there sorry we're catching up
Note that destination here needs to be a stripe connected account id
If you're testing, you can use any of the test cards, such as pm_card_visa to complete the payment
like the user id account?
acct_1234
Hi there ๐
your connected account's account ID
I'm also taking a look
could you be super awsome and show me a code snip?
Looking at the snippet you provided, it looks like you're doing immediately processing an off-session payment since you're passing confirm: true. In order for that to work you will need to have already collected the customer's payment method details and used them to create a Payment Method.
Have you started scoping how you plan to collect your customer's payment method details?
Sure
now that I can charge a customer , how can i send that money to another customer.
I would also like those funds to be pending confirm for 5 days
is that possible
You don't, that is to say you cannot send funds to a Customer. You'll want to use Connect for enabling third-parties to receive funds, and those funds will be sent to their Connected Account's balance.
Looking back at the snippet at the beginning that is what is accomplished by the transfer_data.destination parameter.
i though i was using connect
Sorry, maybe it's the "customer" term that you used which confused me. Customers are specifically parties that pay for payments, those objects cannot receive funds.
Taking a step back, what is the flow that you're trying to model?
Apologies for the lack of clarity, what I was trying to understand is what is the business flow you're trying to build. Particularly whether you're trying to build a process that involves third-parties who are crucial to fulfilling your orders (drives, vendors, etc), or if you're trying to build a money-moving platform.
I have a system where people can sell data in an auction manner.
A user should be able to save a credit card or bank information.
A user is charged when data is purchased through their account.
The user who sold the data profits.
example:
billy is selling 40k records of people who are white, male, and live in florida.
billy pings our system with his information,
the data is sold to the highest bidder.
i need to be able to perform the following three functions:
-collect user bank info
-charge users when a set of events occur in the system. (note: the user being charge should not require any input at the time of the transaction)
-deposit money into a users bank
Okay, so in that example Billy would be onboarded as a Connected Account, and your users would be represented by Customer objects.
If Billy is expected to provide records for your service to sell, and also be a user who purchases records, then Billy will need to be onboarded both as a Connected Account and as a Customer.
wait im seeing this error from the first issue i had
before we continue, can we go back to the first issue, the image i just uploaded
What is the error you're seeing there?
so this is how i tried to charge the account :
paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
transfer_data: {
destination: stripeBankId,
},
description: `Campaign id is${campaignId}. Campaign name is ${description}`
});
just the error from the image i uploaded
Also that won't "charge the account" that charges your Customer and then creates a Transfer to move the funds from that Payment Intent to the Connected Account.
The ID of an existing Payment Method.
Circling back to my previous question, have you started scoping how you plan to collect payment method details from your customers?
If your goal is simply to test the destination charge portion of this process, then you can make use of our test cards to avoid needing to collect payment method details at this point:
https://stripe.com/docs/testing
const account = await stripe.accounts.create({ type: 'express' });
const stripeBank = new StripeBank({
createdAt: Date.now(),
lastUpdate: Date.now(),
creator: req.userData.userId,
stripeBankId: account.id
})
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
})
where do i get the payment method from?
That creates a Connected Account, it does not create a Customer or a Payment Method.
It sounds like you want to collect customer payment method details as their registering with your service, and not necessarily when a payment is being processed, so I think this flow is a good starting point for the payment method detail collection process:
https://stripe.com/docs/payments/save-and-reuse
once sec
1 sec
so i keep being told different stuff
different flows
this is the functionality i want to build:
I have a system where people can sell data in an auction manner.
A user should be able to save a credit card or bank information.
A user is charged when data is purchased through their account.
The user who sold the data profits.
example:
billy is selling 40k records of people who are white, male, and live in florida.
billy pings our system with his information,
the data is sold to the highest bidder.
i need to be able to perform the following three functions:
-collect user bank info
-charge users when a set of events occur in the system. (note: the user being charge should not require any input at the time of the transaction)
-deposit money into a users bank
does the flow you suggest allow me to deposit money into their account?
It's hard to be explicit because it seems like "user" can be both the person paying for payments, and the third-parties receiving funds from payments.
That is difficult to map into Stripe terms because we don't have the concept of an entity that can both pay and be paid.
The flow I provided a link to is for collecting Customer payment method details (this creates the Payment Method that can be used to pay for payments.
The other side of that flow, is then routing the funds from your payments to the necessary Connected Accounts as well. That is handled by the Destination Charge flow that you were referencing earlier. This is the part of the process that focuses on getting funds from payments into the balances of your Connected Account's Stripe balance, so those funds can then be transferred to the External Account (bank account/debit card) associated with the Connected Account by a Payout.
That is difficult to map into Stripe terms because we don't have the concept of an entity that can both pay and be paid.
-- I though that stripe connect was used for this? I was told to use this
The flow I provided a link to is for collecting Customer payment method details (this creates the Payment Method that can be used to pay for payments.
-- so I had this previosly set up and i was told to switch to stripe connect
so I guess what do i need to do to comeplete Destination Charge flow?
Stripe Connect is used for flows where you need to send portions of payments you receive to third-parties. The flow gets more complex when those parties are also customers.
There is a process for debiting Connected Accounts, though it has restrictions that limit its availability.
https://stripe.com/docs/connect/account-debits
Based on the snippets shared previously you're using Express accounts, so that requirement is satisfied, leaving the regional limitations being the biggest hurdle.
If that approach doesn't work for you, then you'll need a combination of the two flows you've been working with previously. You'll need:
- A flow to onboard your users as Connected Accounts so they can receive funds
- A flow to create Customers and save Payment Methods for your users
- A flow to process payments using your Customer's Payment Methods and sending portions of those funds to your Connected Accounts.
so with the flow you are suggesting, i can charge/pay customers?
๐ stepping in for my teammate! I recommend reading through the Account Debits docs to see if that (in addition to destination charges) will allow you to solve for your use cases
Sorry! Just reading the thread history
ok
I think what you'll want to do is create connected accounts/onboard users who are selling data so they can receive funds from the sale.
thats already happening
You'll probably want to use destination charges to charge end customers who are buying this data, and so you can transfer funds to the connected accounts of the people who are selling data
and you can use account debits to charge the users who are selling the data: https://stripe.com/docs/connect/account-debits
so for the start of the flow, this is what i have:: ( what information from the user account do i need? )
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 }) // used to store account.id in my database
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'http://localhost:4200/settings',
return_url: 'http://localhost:4200/settings',
type: 'account_onboarding',
});
i been trying to get this to work for like a week
hello
I think you might be mixing some things up here. The first thing you'll want to do is create the Express accounts, then create account links to have the people who are selling data onboard to your platform.
i though the code that i shared was the creation of the express account?
As part of the onboarding process, these individuals will provide their business information to Stripe, including bank account information (that you'll then use for payouts and for account debits)
Not exactly. Customer objects are completely separate, and you won't be creating the bank account objects yourself
can you provide me with the code snip for creating the express accounts?
your code above includes this already:
const account = await stripe.accounts.create({ type: 'express' });
that's all you need to create an Express account, but you can pass along more information about the business if you already have it: https://stripe.com/docs/connect/express-accounts#create-account
so what do i need to do now?
once you've created and onboarded your Express users, you can create destination charges and specify the transfer_data.destination to be the account which should receive the funds: https://stripe.com/docs/connect/destination-charges
You'll need to integrate the payment flow into your application. Step 3 in this guide (the creation of the PaymentIntent) is where you'll specify transfer_data.destination: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
right right,
this is my code when performing a charge
paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
transfer_data: {
destination: account.id,
},
description: Campaign id is${campaignId}. Campaign name is ${description}
});
but it does not work
what exactly doesn't work? The code above should create a PaymentIntent with the status requires_payment_method
Yep, that all looks correct. You'll want to use the PaymentIntent's client_secret and Elements to collect payment details from your customers
I recommend starting with this guide: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
This quickstart guide goes along with the docs above: https://stripe.com/docs/payments/quickstart
It includes a downloadable app, as well as a way to toggle between a few different backend languages
I dont want to embed a custom Stripe payment form on the website lol. I just need to fix the issue
please just provide a code snip
i really dont know how to read those docs
Okay, I don't think I follow. A PaymentIntent is a state machine: it tracks a customer's intent to pay for something. In order for a customer to pay, you'll need a frontend payments integration to securely collect a customer's payment details
So, so far, you've created PaymentIntents for specific amounts. The next step is to have customers submit their payment details
I though i collected the payment details with this:
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
})
this is so confusing wtf lol
when i run that code, it asks me for my bank account info
is there a number i can call you at?
my goal is to:
1-collect user bank info
2-charge users when a set of events occur in the system. (note: the user is not asked to confirm or approve the transaction)
3-charge should not require any input at the time of the transaction)
4-deposit money into a users bank
juice-payments-multiplequestions
@tepid mica looks like you had a long back and forth with multiple of my colleagues but are still mostly lost. What can I help with?
Let me ask questions that will be easier
1/ The customer is the person paying for the service. How are you expecting them to pay? Via card? Bank account debits? Something else?
with a credit card or bank.
Quick warning: I'm really nitpicky and extremely direct, hope it's okay since you have had back and forth for hours with no progress
Please be extremely specific and clear when responding. You said "or bank" which can mean everything and nothing. What exactly do you need to support: card payments, bank account debits like ACH Debit in the US? SEPA Debit in Europe? Other things?
below is the code that saves a user bank information ( info used to pay for services. this info is also used for retrieving payment)
the flow starts when a api is hit
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!"
});
});
}
Now that the users bank info has been saved, i need a flow to create a charge against their bank account:
let paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
transfer_data: {
destination: account.id,
},
description: `Campaign id is${campaignId}. Campaign name is ${description}`
});
I get an error when i try to create a charge against a users bank info (account.id)
so i need to know why i am getting an error, and what do i need to do to fix it
Please answer the exact question I asked, nothing else. You just dumped half of what you said multiple times earlier which still doesn't really make sense and is why you're completely stuck
Please be extremely specific and clear when responding. You said "or bank" which can mean everything and nothing. What exactly do you need to support: card payments, bank account debits like ACH Debit in the US? SEPA Debit in Europe? Other things?
bank is the credit card information or savings account used to pay/be-paid for the goods purchases
I'm sorry but this doesn't mean anything again
We accept 20+ paymeht methods. If you want more help I need you to take the time to respond clearly to what I ask. If you do, you'll be unblocked in 30 minutes
what!
What exact payment methods do you want to accept. Are Customers only paying with card details (debit or credit doesn't matter)? Or are they also paying by entering their bank account details and then you debit their bank account which can take 5/7 days to succeed in the US? Or are you also in Europe?
@tepid mica do you have an answer to my question above?
1 sec
What exact payment methods do you want to accept?
-anything i dont care
Are Customers only paying with card details (debit or credit doesn't matter)? Or are they also paying by entering their bank account details and then you debit their bank account
-customers can pay what ever way they want
Okay. So before going deep into Connect. The first step is to learn how to accept a normal payment for yourself.
Have you done that already?
i have not done that....
i just want to be clear of my goal, and make sure that stripe can do what I need to achieve. i been trying to set this up for like 5 days and cant make any progress...
1-collect user information that will be used to pay for goods,
2-charge users when a set of events occur in the system. (note: the user is not asked to confirm or approve the transaction)
3-send money to user that sold the goods
yep all of that is doable and really easy
But you have to understand how multiple separate products work, separately and together, and you seem to have rushed through some of it too quickly and now you keep pushing, when you need to go back to the basics
Question 2: Do you need to own the payment UI yourself or are you fine if we own that part. The part that collects the payment method details
you guys can own that, thats fine
Okay that will make things drastically easier
Question 3: What causes the "capture of the funds". Like you ask John Doe for his card details on Monday, what happens after that and does John Doe know how much he'll have to pay and when?
so when a user signs up for an account, they need to input their card details.
then the user can create a 'campaign' where he/she specifies which type of data they want to purchase.
at some point in the future:::
a seller pings our system with the data they want to sell.
our system pings users that are interested in buying the data. Those users submit their bid to buy the data.
our system looks at the bids, then picks the highest bidder, then the account is billed.
but this all happens automatically.
when our system pings the users that are interested in buying the data, and there is a response, that is automatic. no need for a user to manually submit a bid.
does that make sense?
Kind of
Okay so looks like you want to collect payment method details now and the payment can happen any time later, like could be days or weeks
yes
How does John Doe decide how much they are willing to pay? Like you can't ask for card details and then 2 months later charge then $20k without their approval
I mean you can, it will just fail or be disputed and make you lose a ton of money. So it's not what you want
lol.
How does John Doe decide how much they are willing to pay?
because our system 'pings' John Doe and ask them: Hey, we have 15k records for men who smoke in florida, how much do you want to pay for these?
this is all done through API calls
okay so what you described is not really true
you collect card details on Monday, then maybe 10 days later you ping them and say "hey do you want this" and they enter how much they'd pay, and could totally enter card details then
But ultimately: You should use Checkout to collect card/payment method details. Since there's no payment at that point, you use mode: 'setup'
See https://stripe.com/docs/payments/save-and-reuse?platform=checkout which walks you through this end to end
nooo
After that, you will have a Customer cus_123 and its PaymentMethod pm_123 and you'll have the missing piece you had earlier for the PaymentIntent
il make a video. 1 sec
I don't need a video
i need to go to the gym though
but i need to do this by wedneday
so we need to reconnect
You're welcome to ask again but right now I gave you everything you need. If you need this built quickly, you can hire a professional
yea lets reconnect, i need to cool off a bit. i will make a video and try again later on, i will also write out in detail other stuff