#holykent

1 messages · Page 1 of 1 (latest)

acoustic pewterBOT
rare wyvern
#
    public async Task<string> CreateSetupIntent(string paymentMethodId)
    {
        var options = new SetupIntentCreateOptions
        {
            PaymentMethodTypes = new List<string>
            {
                StripePaymentMethods.Card
            },
            PaymentMethod = paymentMethodId,
            Usage = "off_session"
        };

        var service = new SetupIntentService();
        var setupIntent = await service.CreateAsync(options);

        return setupIntent.ClientSecret;
    }

Currently it looks like this without exception handling and retries.

is that "enough"?

worn pilot
#

We mark all the required params in the api spec

acoustic pewterBOT
worn pilot
#

Yeah I mean that looks fine

#

But whether or not it's enough depends on your integration

#

Recommend reading the different options to see if you might need them

#

The above is plenty if you're just going to accept card payments

rare wyvern
#

Do you have a link to that? I find it hard navigating the stripe website tbh

#

yeah thats all im going to do

#

off-session payments

worn pilot
rare wyvern
#

and i assume i need to pass client secret to make sure that they do whatever further authentication may be required

#

like with paymentIntent.Confirm()

worn pilot
#

yep

#

But follow that second link I sent above

#

That should guide you through everything

rare wyvern
#

Is step 3 in the docs you sent really necessary? Creating a customer? I have my own customer entity but it's just for record keeping on our end.

wicked dune
#

Hi, taking over and catching up

rare wyvern
#

Gotcha. It says "Create a Customer object when your customer creates an account with your business. "

In my case, u dont need to be a user with an account to make reservations on my website.

#

a customer is created in my db only after the first reservation is successful

#

it would seem like all i need is a setup intent

wicked dune
#

yes, you need that step. It ties the payment method object id to that customer object and then be able to re-use it later.

rare wyvern
#

Ok and does every setup intent need to be authorized in the client?

Like, with paymentIntent, when you do Confirm, if it's "requires_action" i send the clientsecret for further authoirzation, and the client code explicitly looks for this status to initiate the authorization.

But with setup intent, there is no "requires_action" or anything since no payment has actually been made, so what's teh difference?

#

it's only off-session usage mind you

wicked dune
rare wyvern
#

I think the difference in those docs is, it's attached to a customer instead of a paymentMethodId, and i don't see why that is necessary unless the code logic mandates it.

is this flow not possible?

  1. user inputs card details into stripe element form
  2. paymentMethodId is sent to my server
  3. Create setup intent with paymentMethodId
  4. Save setupintent Id to db to my custom Customer entity (which is created after reservation is actually finalized)
  5. return clientsecret for further authoirzation
  6. A month from now, I create a paymentIntent using the setup intent id (it has the paymentMethodID)
  7. Confirm intent
#

if that wont work, im not sure WHEN to create a customer. It doesn't seem very obvious from the docs.

"When the customer submits your payment form, create a SetupIntent on your server."

this makes it seem like the customer is created before they've even interacted with the stripe element form.. and that's like, how? they are just anonymous guests, they dont need to be logged in to book a hotel room.

#

I want to create the setup intent AFTER they've submitted the stripe element form

#

In my situation, I dont really care who the setup intent belongs to, I just know that I need to extract some money frm that setup intent at some point. And when and if it fails, we will eat the costs of that.

wicked dune
#

So you need to attach the Payment Method to the customer id to later re-use it. That is just how it's built.

rare wyvern
#

and multiple setup intents can be associated with one customer object?

#

we have anonymous guests on our website who can book. they can attach a name or whatever, but that is hardly reliable identification.

So... how do i make sure that when the same anonymous guest makes another reservation in the future, that we reuse the same customer object?

wicked dune
#

Yes, that is correct.

#

You use that customer id again.

rare wyvern
#

is paymentmethod property literally a specific payment method (card, bank account, whatever) (as in that combination of card details) and not just a "type of payment method"?

wicked dune
#

Can you reword this ask please?