#shsolutions - integration

1 messages ยท Page 1 of 1 (latest)

crystal hazel
#

Hi there. Just curious, what integration guide are you following?

stark monolith
#

Good morning codename_duchess, I appreciate your help.

I was working yesterday with Toby and Snufkin. Here's a link to that discussion: #dev-help message

I am trying to integrate Stripe payments into a desktop application. So they explained that I would need to create the card, product, and price objects, and then create a PaymentIntent object for processing the payment. They were very helpful with resources, but after reading the resources I'm still very confused and don't see where everything comes together...

And I also saw different examples that combined the Product and Price objects, so I don't know if that makes more sense either...

But I'm having a very hard time understanding the payment processing structure and how everything connects.

#

I also feel as though the Card object should be assigning the result to something similar to how Products and Price are... But I can't find a way to do that and the example in the Stripe documentation doesn't do that...

But something like:

Stripe.Card card = ?

#

Because without doing that, I don't have anything to actually pass to the PaymentIntent object... Unless I'm missing something.

crystal hazel
#

Ok. Discord is very busy, so I don't have the bandwidth to re-read that thread. I'm curious why they suggested you should create products and prices because PaymentIntents are created with amounts, not Product/Price objects

#

You would just specify the amount directly

stark monolith
#

Hm... I will try that instead...

How do I add the card information or the Card object to the PaymentIntents?

I realize you

#

I realize you're very busy and appreciate your help.

crystal hazel
#

No problem

#

You just pass the id after you've created the payment method

stark monolith
#

Thank you very much.

Sorry for having another question. But how do I get the Card ID from the Card Object?

I don't see an option to get the ID from service or optionsCard...

Am I missing something? Looking at the example on the pages you sent I don't see where I get the response from the objects...

crystal hazel
#

It's all good. It can be a bit confusing. So in Stripe there are Card objects (which are the legacy approach to creating card payments) and Payment Method objects (the new recommended approach). Payment Methods are objects that can be a number of different payment method types (including cards). So, it's recommended to create a Payment Method object of type card here: https://stripe.com/docs/api/payment_methods/create#create_payment_method-type

#

In the response to that object, there is a id param

#

That is what you'll pass to the payment intent

stark monolith
#

Thank you very much. I feel like I'm going to feel very stupid when I finally get this, but I don't understand how I get the results from the PaymentMethodCreateOptions.

Where do I access the result so that I can access the ID?

I tried something like this, but this didn't work...

Stripe.StripeList<PaymentCard> CardDetails = Cardservice.List(optionsCard);

I also tried:

Stripe.Card cardDetails = Cardservice.Get(id);

But that also didn't work.

I'm sorry, but I'm just not getting this and I don't understand why.

What code do I use to access the results from the PaymentMethodCreateOptions? What am I missing? I genuinely appreciate your help and patience...

crystal hazel
#

I'm not a .net expert, but you'll need to assign this to a variable to get the response object: service.Create(options);

#

Then you can access the id property on the response

#

I could be wrong about this actually since I'm not a .NET expert. Let me rope in a colleague

#

@modest tusk
In this code:

   service.Create(optionsCard);```
How would you access the properties on the PaymentIntent object? Are they within the service variable, or do you actually need to assign `service.Create(options);` to a new variable to access them?
stark monolith
#

Thank you very much! I was right, I do feel stupid...

So, the correct code is:

var CardDetails = Cardservice.Create(optionsCard);

and then in the PaymentIntent, I do:

PaymentMethod = CardDetails.Id,

It looks like.

crystal hazel
#

So that code creates a Card object

#

Not a PaymentMethod

modest tusk
#

sorry I'm taking a look

#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

stark monolith
#

Yes, but don't I need to create the Card object first and then pass the ID to the PaymentIntent?

crystal hazel
#

No

stark monolith
#

Thanks Tarzan!

crystal hazel
#

You create a PaymentMethod object and pass that object's id to the PaymentIntent

stark monolith
#

Hm... Let me take another look.

Thank you for your help codename_duchess, and for your help too Tarzan. I appreciate you looking at everything as well.

modest tusk
#

let me know if you need any more help

stark monolith
#

@modest tusk

Thank you very much.

So, I have the below code.

Am I correct that I need to create the PaymentMethodCreateOptions / Card Object, and then pass the ID to the PaymentIntentCreateOptions / Payment Object?

And does the PaymentService.Create(optionsPayment); actually process the payment?

I'm trying to get this integrated into our desktop application and I'm still trying to learn the Stripe structure...

Here is my current code:

        Stripe.StripeConfiguration.ApiKey = AccessToken;

        //Card Details
        var optionsCard = new Stripe.PaymentMethodCreateOptions
        {
            Type = "card",
            Card = new Stripe.PaymentMethodCardOptions
            {
                Number = CCNumber,
                ExpMonth = ExpMonthInt,
                ExpYear = ExpYearInt,
                Cvc = CCCVV,
            },
        };
        var Cardservice = new Stripe.PaymentMethodService();
        Cardservice.Create(optionsCard);
        var CardDetails = Cardservice.Create(optionsCard);

        //Process Payment
        var optionsPayment = new Stripe.PaymentIntentCreateOptions
        {
            Amount = 2000,
            Currency = "usd",
            Description = "Services",
            PaymentMethodTypes = new List<string>
            {
                "card",
            },
            PaymentMethod = CardDetails.Id,
        };
        var Paymentservice = new Stripe.PaymentIntentService();
        Paymentservice.Create(optionsPayment);
#

I really appreciate your help and time.

modest tusk
#

for what it's worth you shouldn't be creating the PaymentMethod this way

#

as far as I understand you're passing the card details over the network to your own API

#

which means that you'd have to be PCI compliant and that's a headache by itself

#

you should either create the payment method on the front-end using StripeJs and just send that PM id to the backend

stark monolith
#

Nothing is being transmitted across our network, it's a class that's built into the local application.

It's a desktop application, so there is no web frontend or javascript for me to use those tools. And the card details are not stored anywhere or leave the local class.

modest tusk
#

yeah I just got a bit of context from a colleague that worked with you yesterday on that

#

you really need to worry about PCI compliance it's really important

stark monolith
#

I think we are compliant though. Nothing is being stored or transmitted other than to Stripe.

modest tusk
#

but it also applies on the form where the CardInfo are entered

#

and one more thing, is the customer the one who are entering the card details? or is it an agent that would that for them?

stark monolith
#

It would be an agent.

#

It would be processed over the phone (in this case).

#

We are separately working on integrating Stripe into our website where the customer would be entering it in.

#

The website will likely use your js components or a shopping cart...

#

But for the desktop application, you don't offer UI components...

#

Our payment form on desktop was originally developed to support PayPal payments, but we are planning to move to Stripe.

modest tusk
#

like technically what you did works

#

it's just the PCI compliance thing. since you're building a MOTO service you should probably look into this

stark monolith
#

I'm sorry, what does MOTO stand for?

#

I also wanted to clarify that the only person that can ever see the card info is the person entering it in, and then only when they're entering it in. The card number gets replaced with Xes and no other card data (CVV, etc.) is stored anywhere ever.

I certainly want to be PCI compliant, I am not dismissing that at all. I'm just explaining the steps we've taken to address those concerns. Because we certainly recognize the sensitive nature of card data and don't have any desire or intention of storing it or otherwise making it accessible.

modest tusk
stark monolith
#

Oh, Ok. I wasn't sure what the acronym stood for. I appreciate that.

modest tusk
#

so you need to contact support https://support.stripe.com/?contact=true

#

and get their help on the subject

stark monolith
#

Stripe referred me to the discord group for my questions about getting this integrated.

modest tusk
#

would you mind sharing the account id?

stark monolith
#

Where do I find my account ID? That's not the secret, correct?

modest tusk
#

yes you can share it without any fear

stark monolith
#

I appreciate your help, but I'm not sure about sharing the secret online since I'm supposed to keep it secret.

modest tusk
#

you can copy it from there

modest tusk
#

I'm not asking you to share your secret key