#ryan-store-response
1 messages ยท Page 1 of 1 (latest)
the function(err, response){}
im trying to store the response at the top level
can i jsut store in a var above?
sorry
I know its really silly
Why not just return the response object at the end of the function call and store that way?
It's alright! It's not a silly question. I'm just trying to understand (:
i need ot return the repsonse as a promise for. firbebase function
when I return directly from the inner function
new resource(stripe).request({
"expected_total": 2998
},
function(err, response) {
// asynchronously called
return response // <====
}
);
like this?
i need it at top level to make it accessible in the rest of the main function
I'm not sure I can answer that question without looking at your whole integration and I'm not very familiar with Firebase. returning the response object will ensure that whatever called the function in the first place will have access to the response. I have no idea whether or not that function exists in main or how to get the return value to the main function
@narrow yacht does this help explain a bit?
im trying to get the function to return the order object or payment intent
but I am being silly
I'm not sure if that will work or not. I would recommend logging out the response object so you can see exactly where the information you want to return lives. It's usually best to return the whole object if you need multiple properties from it.
hey @narrow yacht
thank you for your time
sorry for being silly but it seems I could use this function instead
which is a lot more readable to someone not akilled like me
but when I use this function I get TypeError: stripe.orders.submit is not a function
any idea why that would be?
my tripe object is initialised
stripe
and thank you again
Can you link the docs you're using?
i just realised my test key was in there woops ahah
Is the stripe object declared within a scope that is accessible by the function call?
yes definitely
i am using stripe.orders.create( for testing right above that call so the stripe.orders works fine for that call
Can you post all the relevant code and leave a comment on it right above the line that's creating the error? I have no way to know what to advise without more context
Can you send me the account ID that's being used to make the call? (it will look like this acct_abc123)
my main account?
sure
acct_1KhXZFGtw6jWtSam
thanks so much two shoes
and I am really sorry for taking up your time
I really appreciateit โค๏ธ
Can you post the code where you're initializing the stripe object as well? Like the whole page as text, rather than a screenshot?
Can you try initializing stripe inside of the CreateOrder function and see if that fixes it?
ill give it a go ๐
even like this same error
but don't worry two shoes
I am taking too much of your time
I will go try figure it out
and I want to give my greatest thanks for your assistance tonight
No worries! That's what I'm here for. Happy to help and best of luck ๐