Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:53:29+00:00 2026-05-27T19:53:29+00:00

I’m trying to follow this simple examples given in the google web store API

  • 0

I’m trying to follow this simple examples given in the google web store API docs.
Unfortunately their minimal PHP example contains a lot of stuff I dont need (and dont have setup).

So I’m looking at hardcoding the basic stuff into the HTML file, just to get communication with the google servers working:

My code looks like this:

<html>
  <head>
  </head>
  <body>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      purchase = function() { console.log("Old purchase function"); }
        generatedJwt = "..."; // I use a real JWT here....
        google.load('payments', '1.0', {
          'packages': ['sandbox_config'],
          callback: function()
          {
            //Success handler
            var successHandler = function(purchaseAction){
              if (window.console != undefined) {
                console.log("Purchase completed successfully.",purchaseAction);
           }
          }

          //Failure handler
          var failureHandler = function(purchaseActionError)
          {
             if (window.console != undefined)
             {
            console.log("Purchase did not complete.", purchaseActionError);
         }
           }

           var purchase = function()
           {
          goog.payments.inapp.buy({
                 'jwt'     : generatedJwt,
                 'success' : successHandler,
                 'failure' : failureHandler
              });
           }
        }
      });
   </script>
   <button class="buy-button" id="buybutton1" name="buy" type="button" onClick="purchase()">
      Buy
   </button>
 </body>

When I click on the buy button I get an error message pop up from google, and the following error in the console:

Unsafe JavaScript attempt to access frame with URL   
http://localhost/google_iap/buy_page.html 
from frame with URL
https://sandbox.google.com/checkout/inapp/static/gwt/payments.html?viewportScreenCenterX=-857.5&viewportScreenCenterY=611#id=I1_1324454042050&parent=http%3A%2F%2Flocalhost&rpctoken=166967692&_methods=onPurchaseActionStatus%2CgetJwt%2C_ready%2C_close%2C_open%2C_resizeMe.
Domains, protocols and ports must match.

What do I need to do to make this simple example work?

Addendum:

I found a nicer example from google:

https://sandbox.google.com/checkout/customer/gadget/inapp/demo.html

However saving the source to my machine and accessing it locally ( as http://localhost/google_iap/google_demo.html ) gives the same cross-domain error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:53:30+00:00Added an answer on May 27, 2026 at 7:53 pm

    It appears that the google sandbox was broken. This is now working again, so the example seems to functions correctly. However warnings about cross site access still exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.