-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: More SCA upgrades #135
base: master
Are you sure you want to change the base?
Conversation
Awesome! Looks like great work so far. |
2bdd66e
to
fb83adc
Compare
@@ -427,6 +465,67 @@ instance ToStripeParam TrialPeriodDays where | |||
toStripeParam (TrialPeriodDays days) = | |||
(("trial_period_days", toBytestring days) :) | |||
|
|||
instance ToStripeParam SuccessUrl where | |||
toStripeParam (SucessUrl url) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 SessionMode and 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.