Skip to content
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

Passing the token from stripe.js #125

Open
vu3rdd opened this issue Oct 31, 2019 · 1 comment
Open

Passing the token from stripe.js #125

vu3rdd opened this issue Oct 31, 2019 · 1 comment

Comments

@vu3rdd
Copy link

vu3rdd commented Oct 31, 2019

I am trying to call the stripe charge API. The frontend using the stripe.js gives me a token, which needs to be passed as source parameter to the API. Looking at the Web.Stripe.Charge module, I wonder how to do the equivalent step with the older version of the API. In the older version's documentation, there is an equivalent parameter called card. But I don't see how to pass it, the (Charge)[https://hackage.haskell.org/package/stripe-core-2.5.0/docs/Web-Stripe-Charge.html#t:Charge] data type do not seem to have a way to accept the token. Is there anything I am missing? Would appreciate any help. Thanks.

@vu3rdd
Copy link
Author

vu3rdd commented Oct 31, 2019

Ok, this seem to do the trick. In the posted JSON, I see a card key and that would hopefully do the same job as the source key in the new API versions..

  let config = StripeConfig (StripeKey key) Nothing
      tokenId = TokenId token
  result <- liftIO $ stripe config $ do
    createCharge amount currency
      -&- tokenId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant