Closed sytzez closed 2 months ago
Hello! Do you mean something like this?
let checkout_session_id = CheckoutSessionId::from_str("cs_test_xxxxxxx")?;
let checkout = CheckoutSession::retrieve(&client, &checkout_session_id, &[]);
Also, if interested, here is the code! https://github.com/arlyon/async-stripe/blob/f736d90ea0770f56c30e2c904a33858e4706bd1c/src/ids.rs#L497
That's exactly what I was looking for, thanks!
Describe the bug
Sorry if there's already a solution to this problem, I haven't been able to find it, but I'm also quite new to using this crate.
In the Stripe documentation, it states that I should be able to retrieve the CheckoutSession when Stripe redirects the user to a page on my server using a session id query param in the URL.
I have tried using
CheckoutSession::retrieve
using an id of typeString
, extracted from the URL query. (I'm usingaxum
by the way, but this should work similarly for any web server crate). However, I'm not able to construct aCheckoutSessionId
from thisString
, and I've not found much documentation around these various...Id
types which exist inasync-stripe
.For the time being, I've made a workaround to this problem by copy-pasting and slightly modifying the code from
CheckoutSession::retrieve
, but I believe there should be a better way.My workaround:
To Reproduce
Expected behavior
I would expect there to be a way to create a CheckoutSessionId from a String or &str.
Code snippets
No response
OS
Ubuntu
Rust version
1.80.1
Library version
async-stripe 0.39.1
API version
2024-06-20
Additional context
No response