Closed Maggicorp closed 7 years ago
I noticed that you're defining the route as a POST
: .post('/charge', 'buyers#pay')
, but when you're actually making the ajax request you're setting the method to GET
Scott mentioned that this is what the documentation said to do, but I would be surprised if this wasn't causing some sort of issue
Changed it to POST, which helped. New errors. Will update with new error message.
The problem is that the request isn't passing the right data. req.body.email and req.body.id are both returning undefined. It seems that something is being lost when we changed the fetch to an ajax request.
Would you mind console logging what req
looks like in the controller and
posting that?
On May 24, 2017 5:56 PM, "Maggicorp" notifications@github.com wrote:
The problem is that the request isn't passing the right data. req.body.email and req.body.id are both returning undefined. It seems that something is being lost when we changed the fetch to an ajax request.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-boston/team-project/issues/328#issuecomment-303863138, or mute the thread https://github.com/notifications/unsubscribe-auth/AGwgMrRusc5xufHgYROz8sxvgzJ5YIa3ks5r9KeNgaJpZM4NloVe .
I got those properties, new issue is that it can't make the request with them. It is returning a 500 error and not hitting the .catch or .then that comes afterwards. So something is happening here
stripe.customers.create({
email: req.body.email,
card: req.body.id
})
It gets req.body.email and req.body.id to b tok_1AN8dZE4UNzYgNSt3sXXxULe and 3@1.1, which is correct.
Okay, I kept it in the folder and it correctly makes the request now. I added these headers.
const express = require("express");
const stripe = require("stripe")(keySecret);
const bodyParser = require("body-parser");
Sadly, this does not work in the deployed version even thought it works locally. :(
What sort of errors are you getting in the deployed version?
I am having a really hard time figuring out why stripe isn't working deployed and what it is actually creating. Can anyone do a one on one with me about it? I have also just paste some of my questions but I could really use some help looking at it overall
I had to save my secret password in the heroku configuration for it to worked deployed.
this is the issue we are getting. We defined a charge method in the buyer controller with a route that looks like this. We moved the more specific route to be read first.
Here is our ajax call
and here is the controller method. It's not hitting the controller method so we can't deal with any issues in that yet.