#johnykes-checkout

1 messages · Page 1 of 1 (latest)

uneven jay
static tusk
#

hi there

uneven jay
#

are you following a specific tutorial? my guess is that this is meant to indicate that your code should swap out {CHECKOUT_SESSION_ID} for the actual value, not that something will automatically interpolate the value for you

#

ah, no, you're right sorry

#

tbc, then - the issue you're having is that when the customer is redirected to the success URL, they're being redirected to literally "http://localhost:8080/profile/{CHECKOUT_SESSION_ID}"?

static tusk
#

yes, literally

#
{id: 'cs_test_c18mJuS2ibORleDGUSxsrEDWYc8KzpTKmCjwcLQ4MTygVzmP3mTtOkTYjc', object: 'checkout.session', after_expiration: null, allow_promotion_codes: null, amount_subtotal: null, …}
after_expiration: null
allow_promotion_codes: null
amount_subtotal: null
amount_total: null
automatic_tax: {enabled: false, status: null}
billing_address_collection: null
cancel_url: "http://localhost:8080/profile/cancel"
client_reference_id: null
consent: null
consent_collection: null
currency: null
customer: "cus_Kaa7Jtv1rrp1I5"
customer_details: null
customer_email: null
expires_at: 1637971146
id: "cs_test_c18mJuS2ibORleDGUSxsrEDWYc8KzpTKmCjwcLQ4MTygVzmP3mTtOkTYjc"
line_items: null
livemode: false
locale: null
metadata: {}
mode: "setup"
object: "checkout.session"
payment_intent: null
payment_method_options: {acss_debit: null, boleto: null, oxxo: null}
payment_method_types: ['card']
payment_status: "no_payment_required"
phone_number_collection: {enabled: false}
recovered_from: null
setup_intent: "seti_1JzrqIKXC3SV2dGeTx0ThAPD"
shipping: null
shipping_address_collection: null
status: "open"
submit_type: null
subscription: null
success_url: "http://localhost:8080/profile/{CHECKOUT_SESSION_ID}"
tax_id_collection: null
total_details: null
url: "https://checkout.stripe.com/pay/cs_test_c18mJuS2ibORleDGUSxsrEDWYc8KzpTKmCjwcLQ4MTygVzmP3m
#

from front-end, I'm sending this to my backend APIs

      this.successURL = href + "/{CHECKOUT_SESSION_ID}";
      this.cancelURL = href + "/cancel";
#

should the {CHECKOUT_SESSION_ID} be filled by my backed somehow?

        public Session CreateSetupCheckoutSession(CheckoutSessionRequest checkoutSessionRequest)
        {
            Session session = new Session();

            try
            {
                SessionCreateOptions sessionCreateOptions = new SessionCreateOptions
                {
                    SuccessUrl = checkoutSessionRequest.SuccessUrl,
                    CancelUrl = checkoutSessionRequest.CancelUrl,
                    PaymentMethodTypes = new List<string>
                    {
                      "card"
                    },
                    Mode = "setup",
                    Customer = checkoutSessionRequest.customer.Id
                };

                SessionService sessionService = new SessionService(this._stripeClient);
                session = sessionService.Create(sessionCreateOptions);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            return session;
        }

or should it be automatically updated?....

uneven jay
#

but when you go through that checkout flow, does it redirect you to the url with or without the substitution?

static tusk
#

works now

#

I don't know what happened before. lel

#

sorry for wasting your time :))

#

have a great night

uneven jay
#

no worries 🙂