#alex6743_code

1 messages ¡ Page 1 of 1 (latest)

floral sierraBOT
#

👋 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/1360294945595986080

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

verbal wing
#

This is related to the question from earlier today

patent veldt
#

Hi! Do you have the Customer ID from Stripe for that customer?

verbal wing
#

I'm not sure I've created a customer yet. I can share my entire C# code:

#
{
    const string domain = "https://localhost:44344/";
    var options = new SessionCreateOptions
    {
        UiMode = "embedded",
        LineItems = new List<SessionLineItemOptions>
        {
            new SessionLineItemOptions
            {
                Quantity = 1,
                PriceData = new SessionLineItemPriceDataOptions
                {
                    Currency = "usd",
                    UnitAmount = 5000,
                    ProductData = new SessionLineItemPriceDataProductDataOptions
                    {
                        Name = "T-Shirt",
                        Metadata = new Dictionary<string, string>
                        {
                            { "Color", "Blue"}
                        }
                    },
                },
            },
        },
        Mode = "payment",
        RedirectOnCompletion = "never",
        Customer = "12345",
        SavedPaymentMethodOptions
            = new SessionSavedPaymentMethodOptionsOptions
            {
                AllowRedisplayFilters
                    = new List<string> { "always", "limited", "unspecified" },
            },
    };
    
    var service = new SessionService();
    var session = service.Create(options);

    return Json(new {clientSecret = session.ClientSecret});
}```
patent veldt
#

If you haven't yet created a Stripe customer, then don't include the Customer ID.

verbal wing
#

Here's my checkout.html:

#
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="https://js.stripe.com/v3/"></script>
    <script src="Scripts/checkout/stripe.checkout.js" defer></script>
</head>
<body>
    <!-- Display a payment form -->
    <div id="checkout">
        <!-- Checkout will insert the payment form here -->
    </div>
</body>
</html>```
#

How do I create a customer?

#

If I don't, it blows up with this error: 'saved_payment_method_options requires a customer'

#

Which makes sense, because there's no customer

patent veldt
#

The guide you're following is for payments for existing Customers, but you don't have an existing Stripe Customer object, so that's likely not the right guide for you to be using here.

verbal wing
#

Oh, okay.

#

Here's the scenario: we need users to be able to save their credit card information with Stripe so they can use it later for quick payments

patent veldt
verbal wing
#

Thank you, @patent veldt . Is it possible to save CC information on Stripe outside of the pay process too?

#

Does the above save the CC information to Stripe? We don't want to hold any of the users' credit card data

patent veldt
#

Yes, all CC information is always stored in Stripe if you use our client-side tools.

#

Also, you're very welcome!