#mick23_best-practices

1 messages ยท Page 1 of 1 (latest)

granite cometBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225196989143187487

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

unkempt bridge
#

*** First Post ***

Hoping this community is a tad friendlier than StackOverflow.

#

Ultimately, I'm just looking for a basic architectural diagram to know what to build. The building is the easy part.

#

So I've managed so far to have a button I can click which basically does: Create Customer In Stripe from Data Stored in SaaS Application Database.
I've managed to get that basic bit working.
Next step is to Add Card to that Customer in Stripe via the SaaS Add Card page.
But this seems fairly complex, and the docs are severely lacking on details on this architecture.

#

Basic MVC stuff too. No frameworks, libraries or other added complexities (unless absolutely necessary i.e. some of the Stripe stuff no doubt)

dusky schoonerBOT
eternal ruin
unkempt bridge
#

Thanks @eternal ruin I'm actually partially way through that guide after many months of searching for this info.

#

That at least narrows down the 100s of tabs I have open to 1x guide to follow.

#

What I'm struggling to follow is the basic MVC + API Architecture. The guide still seems to be lacking on some of this detail.

#

I'm on Step 4 - Create Setup Intent, at the moment.

#

Thought "SetupIntent" was the idea of basically "Adding Card to Account" kind of thing. But seems something different. I still need to do a bit more reading on this.

#

"Payment Intent" is clear, aka. "I'm about to make a purchase" - But the "Setup Intent" terminology is not clear to me at present.

eternal ruin
#

Yes, a Setup Intent is what you would use if you wanted to save a card to a Customer to be used for future payments

unkempt bridge
#

I see.

#

So my understanding is correct, I'm just getting confused by the docs.

#

Given that. What's the basic architecture here to create the Setup Intent?

#

i.e. SaaS: AddCardToMyAccount.html

#

I'm sure i've got a Browser Tab open somewhere in the 100s I have open about this stuff, but seemed to provide a code snippet which was based on JavaScript on a sample of AddCardToMyAccoutn.html page, with Stripe.js embedded, but which had 3x endpoints, which appeared to be local server based, i.e html talking to mySaaSApp/one, two, thee - which then talked to Stripe API via the SDK etc.

#

I just got a bit lost in the docs at that point as it shouldn't be this difficult to understand. And I never got anywhere with Stripe Chat - but they did point me to enterprise support, which is clearly a non-starter for most - and noticed this Discord chat. And here we are.

eternal ruin
#

Sorry let's back up here for a second - so right now you're at a point where you crreate a Setup Intent, right?

#

Have you gotten the Payment Element mounted/rendered client-side yet?

granite cometBOT
unkempt bridge
#

So this is the step I'm basically struggling with understanding what I need to build.

#

Current state is.... SaaS App, got a manual button for now to "Create Customer in Stripe" - that's working.

#

Which seems to have a few local end points

#

var getSetupIntent = function(publicKey) {
return fetch("/create-setup-intent", {
method: "post",
headers: {
"Content-Type": "application/json"
}
})
.then(function(response) {
return response.json();
})
.then(function(setupIntent) {
stripeElements(publicKey, setupIntent);
});
};

var getPublicKey = function() {
return fetch("/public-key", {
method: "get",
headers: {
"Content-Type": "application/json"
}
})

#

i.e.

/create-setup-intent

#

and

/public-key

#

It's at this point I got a bit lost. Feeling like I'm having to read an entire codebase just to understand basic architectural concepts.

urban delta
#

๐Ÿ‘‹ stepping in for my teammate! Thanks for sharing the above.

unkempt bridge
#

Re. "Have you gotten the Payment Element mounted/rendered client-side yet?" - Possibly. It's a v0.001 right now. I'm still trying to figure out the details.

urban delta
unkempt bridge
#

I'm still struggling with the basic architecural concepts of what I need and where with the basic MVC + API stuff. i.e. some API is client side talking to Stripe, some API stuff is Server side talking to Stripe.

#

Thanks, I'll take a read over those in the next few days

#

To be explicit, I don't want to make a payment at the same time as adding a card though.

#

I'm looking for basic steps here. 1) Create Customer (Done) 2) Add Card to Account (Trying to figure out) 3) Subscribe to Product (To do)

#

But I think the links above has given me a next step to achieve this.

urban delta
#

For SetupIntents, the typical flow is to:

  • create a customer server side
  • create a SetupIntent for that customer server side,
  • Pass the SetupIntent's client secret to your client side
  • Use the client secret to create and mount a PaymentElement
  • Use confirmSetup client side to confirm the SetupIntent with the values provided by the customer in the PaymentElement
unkempt bridge
#

Right, so that last 5 point message, you have something in that. That's the thing I'm looking for, but in diagram form. It's the Conceptual Version. What I'm looking for is the more Physical (aka. practical/hands on) side of that info, which is probably another 10-20 bullets/items on a diagram (preferable)

#

As for the "If you want to render the PaymentElement before creating a SetupIntent, we have an alternative flow for that: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup" - I don't quite understand the terminology here, in my head that's the same thing - I'll have a read of that link though, thanks.

Build an integration where you can render the Payment Element prior to creating a PaymentIntent or SetupIntent.

#

BTW, can I just say a HUGE THANK YOU to everyone in this chat so far.... You guys have been 1000x more helpful than the Stripe Support via the website already, and I've been battling with them for over 6 months. So thank you.

urban delta
#

Happy to help! Building the right integration is hard and terminology makes it harder

#

We only recently released the flow to collect payment details before creating an intent, I believe primarily because some users wanted to cut down on the round trips between server and client

#

Previously, you needed a client secret (either from a PaymentIntent or SetupIntent) before you could even show your customer the PaymentElement. Some feedback we received was what if, in a payment scenario, you didn't know the full amount yet or you wanted to charge a different amount based on the kind of credit card a user used?

unkempt bridge
#

Yeah this stuff is hard, no doubt about it

#

So just for terminology, what is "Flow" - I'm assuming that is something that Stripe refers to as Options for A>B>C, rather than a prescribed Stripe fixed view of the world?

#

And also to confirm my understanding re. "Stripe Elements" - Are these basically just pre-build abstractions to include in my HelloWorld.html page for things that can Securely Interact with Stripe? Seems to be the case.

#

From what I can understand about the basic architctural concepts, seems as though Stripe.js (with "Elements" aka. Code Snippets interacting with Stripe.js) on the Client Side, basically talk from Customer --> Stripe, then Server Side, SaaS can basically talk SaaS <--> Strripe (API or WebHooks) which basically controls the PCI DSS Compliance aspect - If I've understood things correctly?

#

BTW, I'll be logging off soon, so will pick up this conversation in a day or two - It's not an immediate thing I need to solve, it's a work in progress over time.

urban delta
#

Yep, I think you're understanding things correctly

#

We don't keep threads open if our conversation is idle so I'll close this thread out in a few minutes. I recommend playing around with the guides above and returning to #help if you have more questions.

unkempt bridge
#

Right ok, I think I'm starting to understand now based on this chat. Lots of missing pieces of the puzzle being filled in/confirmed.

#

Yeah sure re. the chat. I assume I can still access this chat for future reference even though it's closed off?

urban delta
unkempt bridge
#

Sounds good, let me have a bit more of a play with the Elements stuff then and that should give me a step forwards.

#

BTW, is this a Stripe Channel or a random bunch of devs around the world? (I'm assuming the former given how helpful you have all been....)

urban delta
#

This is a Stripe channel!

unkempt bridge
#

I'm assuming any username with _stripe is a reputable person

#

Excellent

urban delta
#

Anyone with the Stripe Moderator , Stripe Staff, or Admin role, really

unkempt bridge
#

Bit of feedback if you wouldn't mind passing on internally. Tell teckie people about this channel as soon as possible, I've been battling with the Web Stripe Chat for ages getting no-where, and none of them have even mentioned this mechanism of communication. I wouldn't have been bothering them as much if I knew who to speak to ๐Ÿ™‚

urban delta
#

Noted! You mentioned you went to support chat, then looked into enterprise support before finding this channel. Where did you find a link to join this channel exactly?

unkempt bridge
#

Then naturally when I noticed, and asked, about the ยฃ - I just laughed

#

But noticed this Discord link on the page, so thought it'd be worth a try to engage in trying to find a solution to my 6-12 month old problem

#

I get it, I deal with a LOT of enterprise support contracts in my day job

#

But when teckies SaaS startups are engaging with Stripe, they need be to directed with awesome people like yourself.

#

It's a sales channel ultimately for Stripe - get people onboarded, get a % of every transaction.

#

Job done.

urban delta
#

Totally, understood.

unkempt bridge
#

I actually reached out to someone at Stripe on LinkedIn (think it was some product guy) saying they need my help, basically to improve the docs to provide this info I'm looking for - I'm not selling here, I just like to engage with companies where they have things that annoy me - But my main goal is to integrate with https://yum-info.contradodigital.com and extend that into a platform to empower enterprise organisations to manage their estate easier.

#

So once I get that payment integration stuff sorted, can start expanding the features here

#

Enterprise architecture is an absolute nightmare to manage, as I'm sure you're well aware.

#

Anyhow, good to chat, thanks again for being a human being with deep technical insights to able to have a sensible conversation. It's given me the next step I need!