This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-28
Channels
- # admin-announcements (1)
- # aws (2)
- # beginners (21)
- # boot (28)
- # braid-chat (1)
- # cider (51)
- # cljs-edn (7)
- # cljsjs (35)
- # cljsrn (2)
- # clojure (85)
- # clojure-chicago (7)
- # clojure-czech (1)
- # clojure-gamedev (3)
- # clojure-poland (2)
- # clojure-russia (80)
- # clojure-sanfrancisco (1)
- # clojure-uk (5)
- # clojurebridge (9)
- # clojurescript (68)
- # cursive (29)
- # datomic (23)
- # emacs (2)
- # hoplon (94)
- # jobs-discuss (15)
- # juxt (2)
- # liberator (2)
- # luminus (16)
- # mount (12)
- # off-topic (7)
- # om (57)
- # onyx (58)
- # proton (10)
- # re-frame (9)
- # reagent (38)
- # remote-jobs (2)
- # rum (12)
- # untangled (136)
Has anyone used stripe with hoplon?
Couldn't find any example online
Found this issue with reagent and stripe https://github.com/reagent-project/reagent/issues/134
But even in vanilla clojurescript can't find anything...
Yes and i'm very far from having a payment form
@dm3 Actually cljsjs.stripe doesn't load properly. (Can't find namespace)
But that aside wouldn't be sure how to convert the following in hoplon
@dm3 Interesting! Is he on Slack too?
Excellent, yes! Will do
Hey guys. Just some musing: Say you make a record
in the server, and it’s served to the client. Would the record’s methods still be available on the client?
@dm3 So here I only add cljsjs lib and require it at index.cljs.hl
And I get this when building...
ERROR: No such namespace: cljsjs.stripe, could not locate cljsjs/stripe.cljs, cljsjs/stripe.cljc, or Closure namespace "cljsjs.stripe" in file /Users/leontalbot/.boot/cache/tmp/Users/leontalbot/Dropbox/Sites/hoplon-stripe/1d8/62mkia/hoplon/app_pages/_index_DOT_html.cljs at file hoplon/app_pages/_index_DOT_html.cljs
@dm3 Not sure I get your question...
Any ideas?
Maybe I should ask to #C0E66E1H7 channel
@levitanong: I have no idea
META-INF/MANIFEST.MF
META-INF/maven/cljsjs/stripe/
META-INF/maven/cljsjs/
META-INF/maven/
META-INF/
META-INF/maven/cljsjs/stripe/pom.xml
deps.cljs
cljsjs/common/
cljsjs/
cljsjs/common/stripe.ext.js
META-INF/maven/cljsjs/stripe/pom.properties
@leontalbot: time to experiment
hi @leontalbot @dm3 i just got online, saw your discussion about stripe. as a matter of fact, i’m just wrapping up a new project using stripe and hoplon
Nice!
Would you mind showing a minimal example?
so the thing with the cljsjs stripe is that the stripe js not available to be downloaded. it works similarly to the google maps component for hoplon
got it!
cljsjs stripe basically just provides the ext file so you can compile in advanced mode
cool!
I was there
(def stripe-script-url " ")
(defc stripe-pub-key "")
(defc stripe-ready? nil)
(defn stripe-init! []
(do
(.setPublishableKey js/Stripe @stripe-pub-key)
(reset! stripe-ready? true)))
(defn ensure-stripe []
(.getScript js/jQuery stripe-script-url #(stripe-init!)))
(with-init! (ensure-stripe))
this is a little more involved. I’m using a form state machine thing that @micha was nice enough to post one time and so I had to do a few extra things to coordinate with it
@leontalbot: i have a call in about 15 minutes but i can review it with you after. or just post any questions you have and I’ll try to answer
excellent! Much thanks!
it’s also a little more complicated by the fact that this app is handling stripe transactions for multiple organizations so it receives its stripe credentials from a castra endpoint
@raywillig So far :
Where can I find spy->>
source?
Could you provide an idea of core/state
structure?
(if possible)
@raywillig: would be cool if you could add some explanation to cljsjs/stripe/README.md
@leontalbot: spy->>
is part of https://github.com/adzerk-oss/cljs-console
@micha Thanks!
@raywillig: Would you be available for questions?
@leontalbot: sure, just got back from lunch so catch me before i doze off
@raywillig: This would be my first attempt
Does not work
Wanted to get your feedback before moving on
much thanks!
update: input-fields now working
Updated. Now when I submit, I get : "A network error has occurred, and you have not been charged. Please try again."
Maybe it sends twice?
nothing in the logs
well, the thing is that stripe just returns back a token. you’d need to then send that token to your server component to complete a transaction using your stripe secret key. have you done that part?
no this part is still missing
so the only thing you can really verify with this is that you get back a stripe token
The thing is, stripe doesn't return a token
stripe js
stripe is going to call the callback with only two parameters - status and response
so if you want your response handler to be aware of that third argument you should make your response handler arg signature look something like [form-data status response] and then the callback should look like #(partial strip-response-handler @form-data)
@raywillig: Thanks! I finally get smth in the logs
@raywillig: Oups, I can't assoc the token though
(defn handle-stripe-response [form-data status response]
(let [r (js->clj response :keywordize-keys true)]
(if (= status 200)
(do (swap! form-data assoc :token r)
(reset! form-data-ok? true)
#_"FIXME send to server with cljs/http"
#_"FIXME change view")
(reset! error-message (-> r :error :message) {}))))
(swap! form-data assoc :token r)
doesn't seem to work 😞
any idea?
no exception, but no assoc
got it!
(.createToken (.-card js/Stripe) (clj->js data)
(partial handle-stripe-response form-data))
not #(partial...)
Thanks a lot @raywillig ! First step completed!