Interact with Stripe's payment_intents API endpoint. I'm not committing the index.html that contains client-side code that interacts with the /create-payment-intent endpoint, but it contains sensitive information, so I'm omitting it for now. TL;DR: - Define POST /create-payment-intent endpoint - Include envStripeAPIKey in Context record - Define a top-level Stripe module for making API calls - Define types and instances that align with Stripes request and response types - Depend on the Req library: a higher-level library than http-client
16 lines
620 B
Haskell
16 lines
620 B
Haskell
{-# LANGUAGE DataKinds #-}
|
|
{-# LANGUAGE TypeOperators #-}
|
|
--------------------------------------------------------------------------------
|
|
module API where
|
|
--------------------------------------------------------------------------------
|
|
import Servant.API
|
|
|
|
import qualified Types as T
|
|
--------------------------------------------------------------------------------
|
|
|
|
type API = "verify"
|
|
:> ReqBody '[JSON] T.VerifyGoogleSignInRequest
|
|
:> Post '[JSON] NoContent
|
|
:<|> "create-payment-intent"
|
|
:> ReqBody '[JSON] T.PaymentIntent
|
|
:> Post '[JSON] T.CreatePaymentIntentResponse
|