#juice-payments-multiplequestions

1 messages ยท Page 1 of 1 (latest)

bright swiftBOT
tepid mica
#

what do i put for payment_method?

#

hello?

#

yo

#

anyone there?

tender tide
#

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

tepid mica
#

like the user id account?

tender tide
#

acct_1234

arctic island
#

Hi there ๐Ÿ‘‹

tender tide
#

your connected account's account ID

arctic island
#

I'm also taking a look

tepid mica
#

could you be super awsome and show me a code snip?

arctic island
#

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?

tepid mica
#

it works

#

thank you guys

#

now

#

i have another question

arctic island
#

Sure

tepid mica
#

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

arctic island
#

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.

tepid mica
#

i though i was using connect

arctic island
#

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?

tepid mica
arctic island
#

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.

tepid mica
#

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

arctic island
#

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.

tepid mica
#

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

arctic island
#

What is the error you're seeing there?

tepid mica
#

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}`
    });
arctic island
#

That won't do anything

#

You didn't provide a Payment Method

tepid mica
#

just the error from the image i uploaded

arctic island
#

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.

tepid mica
#

dang

#

what do i put for payment method?

arctic island
#

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?

tepid mica
#

yes

#

here is the code for that

arctic island
#

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

tepid mica
#

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
})

tepid mica
arctic island
#

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

tepid mica
#

once sec

tepid mica
#

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?

arctic island
#

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.

tepid mica
#

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?

arctic island
#

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.

With Connect, your platform can directly debit the Stripe balance of an Express or Custom account.

tepid mica
#

so with the flow you are suggesting, i can charge/pay customers?

tepid oriole
#

๐Ÿ‘‹ 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

tepid mica
#

like what do you recommend i do to achive the functionality i want

#

hello

tepid oriole
#

Sorry! Just reading the thread history

tepid mica
#

ok

tepid oriole
#

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.

tepid mica
#

thats already happening

tepid oriole
#

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

tepid mica
#

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

tepid oriole
#

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.

tepid mica
#

i though the code that i shared was the creation of the express account?

tepid oriole
#

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

tepid mica
#

can you provide me with the code snip for creating the express accounts?

tepid oriole
tepid mica
#

so what do i need to do now?

tepid oriole
tepid mica
#

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

tepid oriole
#

what exactly doesn't work? The code above should create a PaymentIntent with the status requires_payment_method

tepid mica
tepid oriole
#

Yep, that all looks correct. You'll want to use the PaymentIntent's client_secret and Elements to collect payment details from your customers

tepid mica
#

?

#

can you provide me with a code snip

#

i dont really understnad the docs

tepid oriole
tepid mica
#

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

tepid oriole
#

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

tepid mica
#

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

dim osprey
#

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?

tepid mica
#

yea its been a rough set of hours.

#

let me summaries

dim osprey
#

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?

tepid mica
#

with a credit card or bank.

dim osprey
#

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?

tepid mica
#

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

dim osprey
#

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?

tepid mica
dim osprey
#

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

tepid mica
#

what!

dim osprey
#

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?

tepid mica
#

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

dim osprey
#

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?

tepid mica
#

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

dim osprey
#

yep all of that is doable and really easy

tepid mica
#

please help lol

#

i been on this for like 5 days

dim osprey
#

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

tepid mica
#

you guys can own that, thats fine

dim osprey
#

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?

tepid mica
#

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?

dim osprey
#

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

tepid mica
#

yes

dim osprey
#

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

tepid mica
#

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

dim osprey
#

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

tepid mica
#

nooo

dim osprey
#

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

tepid mica
#

il make a video. 1 sec

dim osprey
#

I don't need a video

tepid mica
#

i need to go to the gym though

#

but i need to do this by wedneday

#

so we need to reconnect

dim osprey
#

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

tepid mica
#

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