#.captainsunshine

1 messages · Page 1 of 1 (latest)

digital epochBOT
sweet gull
#

Hi 👋 to clarify, are you setting the client_reference_id and the metadata on a Checkout Session that you're creating, or somewhere else?

supple briar
#

We are creating a checkout session:

context.checkout_session = Stripe::Checkout::Session.create(
        {
customer: stripe_customer.stripe_customer_id,
mode: mode,
payment_method_types: payment_method_types,
line_items: line_items,
success_url: success_url,
cancel_url: cancel_url,
client_reference_id: client_reference_id,
metadata: {id: "Bob"},
payment_intent_data: {
  setup_future_usage: 'off_session',
  },
},        stripe_customer.account.api_details
)
#

Hoping that when the payment is complete that the client_ref_id would be returned so we can link it to a payment request, and thus mark an item as paid.

sweet gull
#

Gotcha, then the reason you aren't seeing that data is because you are listening for Events that return objects other than the ones where you put the data. Those details are not automatically copied from the Checkout Session to the objects it creates.

You will either need to listen to a different Event that includes a Checkout Session object, such as checkout.session.completed; or use the ID of the Payment Intents, included in the Events you're currently listening to, to retrieve their associated Checkout Session.

supple briar
#

What events would include that information?