topher
topher
CDCloudflare Developers
Created by topher on 9/19/2023 in #pages-help
Cant fetch Stripe checkout session line items with Stripe lib or fetch, not returning any errors
Request verification is working fine since I updated to use both webCrypto = Stripe.createSubtleCryptoProvider() and
httpClient: Stripe.createFetchHttpClient() (though latter is now obsolete/unnecessary and verification works without it) Stripe is posting to the worker webhook just fine, I get a session with valid id and customer info. I can validate the event okay with
event = await stripe.webhooks.constructEventAsync(
body,
sig,
endpointSecret,
undefined,
webCrypto
);
event = await stripe.webhooks.constructEventAsync(
body,
sig,
endpointSecret,
undefined,
webCrypto
);
but when I run await stripe.checkout.sessions.listLineItems(session.id) or
await fetch(`https://api.stripe.com/v1/checkout/sessions/${session.id}/line_items`, {
headers: {
Authorization: `Bearer ${STRIPEAPIKEY}`
}
})
await fetch(`https://api.stripe.com/v1/checkout/sessions/${session.id}/line_items`, {
headers: {
Authorization: `Bearer ${STRIPEAPIKEY}`
}
})
it works fine locally but never returns on workers. Even in a try/catch it doesn't throw errors or logs. Tried on miniflare and it has the same result as on workers. current preview code is here: https://github.com/spudunk/webboot.io/tree/stripe preview is here: https://stripe.webboot-io.pages.dev/ and https://cb821c96.webboot-io.pages.dev/ deployment ID cb821c96-c052-43ae-87bb-aa1d8b63b0e9 account ID b4ef1aa0fe0e6bff020837c47b6f41bf Worked on it yesterday for several hours then this morning for three more with @embd and can't get it working.
3 replies