WIP: More SCA upgrades#135
Conversation
|
Awesome! Looks like great work so far. |
2bdd66e to
fb83adc
Compare
| (("trial_period_days", toBytestring days) :) | ||
|
|
||
| instance ToStripeParam SuccessUrl where | ||
| toStripeParam (SucessUrl url) = |
There was a problem hiding this comment.
Found a minor typo here.
- toStripeParam (SucessUrl url) =
+ toStripeParam (SuccessUrl url) =|
@emhoracek Not sure if I'm reading it incorrectly or doing something wrong when trying to expand the EDIT: Ok, I managed to get this working with a local clone. I added this to instance StripeHasParam CreateSession SessionModeand this to instance ToStripeParam SessionMode where
toStripeParam mode =
(("mode", case mode of
SessionModePayment -> "payment"
SessionModeSetup -> "setup"
SessionModeSubscription -> "subscription"
UnknownSessionMode t -> Text.encodeUtf8 t) :)According to the API docs, Stripe will only accept the first three session modes. Not sure if I've implemented that fourth case correctly, but it works. Usage is something like this: postNewCheckoutSessionR :: Handler ()
postNewCheckoutSessionR = do
req <- requireCheckJsonBody :: Handler Value
stripeKey <- appStripeSecretKey <$> getsYesod appSettings
ur <- getUrlRenderParams
-- TODO: Fix typo in 'Sucess'
-- https://github.com/dmjio/stripe/pull/135/files#r607576380
let successUrl =
Stripe.SucessUrl $ ur AccountR params
where params = [("session_id", "{CHECKOUT_SESSION_ID}")]
cancelUrl = Stripe.CancelUrl $ ur PricingR []
methods = Stripe.PaymentMethodTypes [Stripe.PaymentMethodTypeCard]
config = Stripe.StripeConfig stripeKey Nothing
action = Stripe.createSession successUrl cancelUrl methods Stripe.-&- Stripe.SessionModeSubscription
liftIO (Stripe.stripe config action) >>= \case
Left err -> do
$(logDebug) $ tshow err
pure ()
Right res -> do
$(logDebug) $ tshow res
pure () |
|
@emhoracek when doing 3d secure returns "TODO" on "cardHash3DSUsage" where this placeholder coming from? |
nevermind, it's a fallback function |
…scriptors Add statement descriptors to payment intent
Building on @NorfairKing's PR, these are the types and endpoints we added to get SCA working on our app. Still a work-in-progress. I realized a bit into our work that we were using the wrong API version in the Stripe Dashboard, so there are probably some inconsistencies with the pinned 2014 version of the API. Still somehow everything works in practice. Next planning on adding all the missing types and endpoints and checking it all against the 2014 version docs.