#lockekosta

1 messages · Page 1 of 1 (latest)

eternal magnetBOT
deft flame
#

Please edit out your api key

#

Still considered sensitive data even in test mode

#

Will delete this thread if it's not edited

#

What do you mean by refuses to work?

#

Is there an error message? What's happening?

granite edge
#

I'm trying to do this as a favor on shopify so not getting much back in response. Basically created the js file, can grab the variable without the API call, adding the API call returns nothing like there's a syntax error.

My understanding is that the variable should be the length and I have 2 active test subscriptions so it should be 2, instead the script doesn't pull like there's a syntax error or something.

#

So it appears to me the API call is straight up just not working, and given how barebones it is, I don't know why not.

deft flame
#

Well if there's no error and it's returning an empty list that means it's reaching our api

#

And it doesn't find subscriptions that meet the criteria

granite edge
#

It's not returning an empty list.

deft flame
#

What is it returning then

#

What does printing subscriptions return

granite edge
#

It's not returning anything. It doesn't work.

deft flame
#

What does printing subscriptions show

granite edge
#

I have this:

<script>
var subAmount = subscriptionType; document.getElementById("sub_link_href").setAttribute("href", "SoldOut" + subAmount);
</script>

And it doesn't work with the API call. Without it, it works and the amount is whatever I put into the variable.

deft flame
#

Can you check for a request id?

granite edge
#

If I'm reading the log right it doesn't look like any request was made

deft flame
#

And you printed out the subscriptions variable after attempting to make that call to see what it contains?

granite edge
#

The script does not work.

#

It opts for the default href.

deft flame
#

That didn't answer my question

#

You're saying the script doesn't run at all?

#

That's server side code you wrote

granite edge
#

That's what it seems like

deft flame
#

It can't run from the browser

#

You wrote node.js code to list subs

#

That can't be done from the browser

granite edge
#

If I take the API call out and just give it an int, it works.

#

So I can't make a stripe API call in shopify?

deft flame
#

I'm not familiar with shopify

#

We just help developers integrate the stripe api directly in here

#

Not familiar with third party plugins and such

#

But the code you wrote needs to be executed server-side

granite edge
#

It's literally a basic .js file

#

Nothing third party about it

deft flame
#

It's server-side code...

#

You can't run it from the browser

#

You need to run it from your server

#

And if you use shopify, you likely don't control the server

#

But idk it's a third party service

#

Also are you a developer? It's extremely important to understand which pieces of stripe code run clientside and which run serverside. Because if you attempt something like the above script in your browser you risk exposing your api secret key, which can give someone the ability to take over your stripe account.