#Ralph-checkout-fulfillment

1 messages · Page 1 of 1 (latest)

proven valve
#

Hi there! What is an "SPA"?

amber light
#

Single Page application

#

So here's the specific question:

#

I have a webhook configured and making a POST to my server correctly, but I'm unsure of how to confirm which actual USER completed the checkout process when the webhook activates

proven valve
#

Gotcha

#

So with Connect Webhooks there is an account property

amber light
#

Yeah so I can get the dealership account and that's good because I can then update the information there

#

But for which specific USER (ie. customer) completed the checkout process, I'm at a bit of a loss

proven valve
#

Oh, not your Connected Account user, the end-customer themselves.

amber light
#

the session will return the users e-mail, but there's a case where they input a different e-mail than their account e-mail

proven valve
#

Got it. Are you using Stripe Checkout?

amber light
#

YEah

#

This is an example response I get from the webhook:

{"id":"cs_test_a1CSJgbhp7hOiOVvKBH1tOWBkzWluSnjRol4jBlyLRHckmPwXNcCg8kD2q","object":"checkout.session","after_expiration":null,"allow_promotion_codes":null,"amount_subtotal":201600,"amount_total":201600,"automatic_tax":{"enabled":false,"status":null},"billing_address_collection":null,"cancel_url":"http:\/\/localhost:8080\/honda\/9999","client_reference_id":null,"consent":null,"consent_collection":null,"currency":"cad","customer":"cus_LRr3pW5qsxYRj5","customer_creation":"always","customer_details":{"address":{"city":null,"country":"CA","line1":null,"line2":null,"postal_code":"N2Z 0C6","state":null},"email":"ralph@shopdesk.io","name":"Ralph Barac","phone":null,"tax_exempt":"none","tax_ids":[]},"customer_email":null,"expires_at":1649193691,"livemode":false,"locale":null,"metadata":[],"mode":"payment","payment_intent":"pi_3KkxL5QhG88walQ21Z5chOz0","payment_link":null,"payment_method_options":[],"payment_method_types":["card"],"payment_status":"paid","phone_number_collection":{"enabled":false},"recovered_from":null,"setup_intent":null,"shipping":null,"shipping_address_collection":null,"shipping_options":[],"shipping_rate":null,"status":"complete","submit_type":null,"subscription":null,"success_url":"http:\/\/localhost:8080\/honda\/9999\/checkout-successful","total_details":{"amount_discount":0,"amount_shipping":0,"amount_tax":0},"url":null}
#

Sorry it's terribly formatted, but the important bit is obviously I do get the e-mail the customer uses

#

Which I CAN cross reference with the dealership they purchased from

#

But they can input an e-mail that is not the same as their account e-mail on our website

proven valve
#

Got it. So there are a couple options here.

amber light
#

Is there a way to pass extra information to the Stripe session object so that when it returns I get the user associated?

proven valve
#

Yep

#

One of the options is to pass your own metadata

#

Which will be returned after the session is completed

amber light
#

What are the other options?

proven valve
#

The other option is to use a Stripe Customer object and either pass one into the Session or have the Session create one.

amber light
#

OK the first option is definitely better for my use case I think

#

I figured something like that was available I just couldn't find it

#

I'd like to leave this thread open for an hour or so in case I have issues but otherwise thanks for your help!

#

can I add metadata to this call:

#
    $session = \Stripe\Checkout\Session::create([
      'payment_method_types' => ['card'],
      'line_items' => $products,
      'mode' => 'payment',
      'success_url' => $successURL,
      'cancel_url' => $returnURL,
    ], ['stripe_account' => $dealer->stripe_account_id]);
proven valve
#

Yep

#

That is the one you would add it to

#

And I'll leave the thread open for a while! Feel free to come back with any more questions

amber light
#

I get an invalid object error when I try

#

oh one sec

proven valve
amber light
#

Yeah I've fixed that issue. One last question, is there a way to pass along this information when I redirect from the stripe checkout to the success_url?

proven valve
#

No you have to pass it on Session creation if you want to pass it yourself. Only the information from the completed session will be returned once the success_url is hit.