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

setup perfectly but it's not working #19

Closed
masuksarker opened this issue Aug 21, 2019 · 17 comments
Closed

setup perfectly but it's not working #19

masuksarker opened this issue Aug 21, 2019 · 17 comments

Comments

@masuksarker
Copy link

please watch this video https://cl.ly/9a03d0

setup everything perfectly but popup button is not showing up in the checkout page and as a result i can't use fastspring.

@cyberwombat
Copy link
Owner

Check out the Troubleshooting page in the Wiki of this repo. You will want to enable test mode and debug. There are two places with info - one is the developer console of the browser - my guess based on your issue that this is where the info needed will show up. The other is found in the Status tab of WooCommerce admin - you can find the fastspring log - thats more to debug communication between FS and Woo however. So turn test/log on, open the dev console of your browser and look at the messages. Do a fresh reload of the cart and paste the entire log here or in a gist.

@masuksarker
Copy link
Author

I have set up perfectly everything. double-check it. But I am getting the error
[FastSpring API] (!) Error: Error received: – 400 – "payload-invalid"

Please watch this video: https://www.loom.com/share/ebf44b6dcfed42d3b50dceba734d9a2d

www.msbacademy.com-1566412341936.log

@cyberwombat
Copy link
Owner

In the log attached there is an error saying no access key. I see that you have it in your video but when I look at the source code of your site I see this:

<!-- HFCM by 99 Robots - Snippet # 1: Fastspring --> <script
--
  | id="fsc-api"
  | src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.8.0/fastspring-builder.min.js"
  | type="text/javascript"
  | data-storefront="msbacademy.onfastspring.com/popup-mystore"></script> <!-- /end HFCM by 99 Robots --> <!-- HFCM by 99 Robots - Snippet # 2: visitor-analytics.io --> <!-- VISA Tracking Code for https://www.msbacademy.com --> <script>(function (v, i, s, a

Did you add the FS snippet manually as well? This may be conflicting. The WP plugin adds that code - with the access key in it. I think you have two different FS code bits happening. Remove that snippet and try again.

@masuksarker
Copy link
Author

yeah, another code was activated. now just remove it. but still its not working properly. please check the log file now
www.msbacademy.com-1566417218752.log

@cyberwombat
Copy link
Owner

You need to whitelist your domain in FS. Here's the relevant error in your log:

Access to XMLHttpRequest at 'https://msbacademy.test.onfastspring.com/popup-mystore/builder' from origin 'https://www.msbacademy.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

From wiki docs: If you have opted to use the Popup Storefront method you will need to contact FastSpring support and ask them to whitelist your store domain.

@masuksarker
Copy link
Author

already added my domain as whitelisted website. see the screenshot https://cl.ly/49cbc6
now, do I need to contact FS support?

@cyberwombat
Copy link
Owner

It does look correct but that error indicates something is not right with that setup. Contact FS support and tell them you get this message:

Access to XMLHttpRequest at 'https://msbacademy.test.onfastspring.com/popup-mystore/builder' from origin 'https://www.msbacademy.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Yet your domain is whitelisted. Perhaps they need to reset something.

@masuksarker
Copy link
Author

got the reply from fastspring support. please check their reply https://cl.ly/eceea1
I want your solution badly......

@cyberwombat
Copy link
Owner

Calling the method as they did does not imply CORS is working. The FS file is loaded on your server so of course you can run methods against it. What doesn't work is sending a POST call to https://msbacademy.test.onfastspring.com/popup-mystore/builder from `https://www.msbacademy.com' which is where CORS needs to be setup for that to be allowed. Please have them double check - perhaps reload the whitelisted domain.

@masuksarker
Copy link
Author

their last reply https://cl.ly/876ff2
what do you think about it? :(

@cyberwombat
Copy link
Owner

Paste your snippet (I assume its the one from above comment) in a file and save that file as cors.html and upload to the root directory of your site (where the wp-config.php file is). The file only needs to contain (to be safe use the one from your dashboard - this is the duplicate code that was on your site earlier which I assume is correct but lets be safe):

<script 
  id="fsc-api" 
  src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.8.0/fastspring-builder.min.js"
  type="text/javascript"
  data-storefront="msbacademy.onfastspring.com/popup-mystore">
 </script>

Then open your browser console and call the URL https://www.msbacademy.com/cors.html and send me what the console says. If it says nothing then CORS is setup correctly - if, on the other hand, you see something like:

Access to XMLHttpRequest at 'https://msbacademy.onfastspring.com/popup-testfastspring/builder' from origin 'https://msbacademy.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Then that implies CORS is not setup correctly by FS. If that is the case, have them escalate the issue to a senior developer (explain that you just pasted the snippet in an html file and there is no WP involved).

@cyberwombat
Copy link
Owner

I see in your logs that you have msbacademy.test. There could be an issue where your domain is whitelisted for production and not test. Ensure you are using the same throughout - the plugin will add "test" for test mode but you'll want to ensure that this is also CORS safe so in your snippet do a test with msbacademy.onfastspring.com/popup-mystore and another with msbacademy.test.onfastspring.com/popup-mystore where it says data-storefront. be sure to not cache your result between tests.

@kskrlinnorth2
Copy link

kskrlinnorth2 commented Jul 28, 2020

I have similar problem - regular payment works, but popup doesn't.

Everything is setup correctly. I can see access token included in code (I changed url and access key for privacy):

<script type="text/javascript" id="fsc-api" data-storefront="mysite.onfastspring.com" data-before-requests-callback="fastspringBeforeRequestHandler" data-access-key="here-is-access-key-from-settings-matching-the-one-provided-by-fastspring" data-debug="true" data-test="yes" data-version="1.2.2" data-data-callback="dataCallbackFunction" data-error-callback="errorCallback" data-popup-closed="fastspringPopupCloseHandler" src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.7.6/fastspring-builder.min.js?ver=5.4"></script>

And code for popup (got this form FS site):

<script id="fsc-api" src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.8.3/fastspring-builder.min.js" type="text/javascript" data-storefront="mysite.onfastspring.com/popup-mysite">
</script>

Domain is virtual localhost and it is whitelisted.

I get this error:
[FastSpring API] No access key found in payload.
[FastSpring API] (!) Error: Error received: 400 empty-session

WooCommerce status log is empty and test and logging is enabled in plugin settings...

@cyberwombat
Copy link
Owner

@kskrlinnorth2 I created a new issue - let's chat there. #21

@Manika-Kumari
Copy link

I have set up perfectly everything. double-check it. But I am getting the error [FastSpring API] (!) Error: Error received: – 400 – "payload-invalid"

Please watch this video: https://www.loom.com/share/ebf44b6dcfed42d3b50dceba734d9a2d

www.msbacademy.com-1566412341936.log

How did you fixed that?

@cyberwombat
Copy link
Owner

@Manika-Kumari it sounds like an invalid access key or a conflict if you have manually added a snippet as OP did. Please open a new issue and provide the log and url as originally asked in this thread and I can take a look.

@Manika0205
Copy link

@Manika-Kumari it sounds like an invalid access key or a conflict if you have manually added a snippet as OP did. Please open a new issue and provide the log and url as originally asked in this thread and I can take a look.

Thanks for getting in touch, I have created a separate ticket, here is the link:
#32

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

5 participants