0

well, it looks like I'm the first in the S.O. community to post a question with a balancedpayments tag.

I recently began developing with balancedpayments. I

  • created a test marketplace,
  • added a "webhook" uri still pending, in the form of: https://www.mydomain.com/main/balancedpayments (maybe this is the problem?)
  • referring to documentation url [balanced.js][1] I added this to my page head section:

    <script type="text/javascript" src="https://js.balancedpayments.com/v1/balanced.js"></script>
    <script type="text/javascript">
        balanced.init('main/balancedpayments/TEST-MP4IaoKYeyteVLTY0nphZijM');
    </script>
    

(In the body, I have made a standard html form, and above the form I added a javascript section using the example jquery stuff found on the balanced.js page, as linked above, I'm not posting that part for now, because it doesn't appear to be related to my initial js error.)

When the document is ready, and before I ever fill in or submit the form, I get this js error: Timestamp: 11/29/2013 12:09:53 PM Error: uncaught exception: Invalid marketplace uri "main/balancedpayments/TEST-MP4IaoKYeyteVLTY0nphZijM"

I will provide any additional information requested.

TARKUS
  • 2,170
  • 5
  • 34
  • 52
  • 1
    Check this out [JS error on balanced.init()](http://stackoverflow.com/questions/10249710/js-error-on-balanced-init). There could be 2nd parameter necessary. Possible duplicate. – Anto Jurković Nov 29 '13 at 20:51
  • @Anto Jurkovic : Thanks. Second parameter? Sheesh, they can't simply correct their example code? It's not like a newspaper that's gone to press already. As for "duplicate", I searched "" (blank) or all results for "balanced-payments" and got not results. I was under the impression there were no threads started, sorry. – TARKUS Nov 29 '13 at 21:17
  • 1
    UPDATE : This is a different specific error, so not a duplicate ;) – TARKUS Nov 29 '13 at 21:23

1 Answers1

1

Did you take a look at this section? https://docs.balancedpayments.com/current/#including-and-initializing-balanced-js

Specifically:

<script type="text/javascript">
    balanced.init('${REPLACE_THIS_WITH_YOUR_MARKETPLACE_URI}');
</script>
Example:

<script type="text/javascript">
    balanced.init('/v1/marketplaces/TEST-MP5JtbXVDZkSGruOJyNasPqy');
</script>

You can find your API key secret and marketplace URI from your dashboard. You will notice that marketplace URIs start with /v1/.... so in this case, your marketplace URI is: /v1/marketplaces/TEST-MP4IaoKYeyteVLTY0nphZijM

There's a live fiddle for you to try it out, http://jsfiddle.net/balanced/ZwhrA/, which is linked to from the documentation.

Mahmoud Abdelkader
  • 23,011
  • 5
  • 41
  • 54
  • Thanks. I have my secret key, but I guess I don't understand the uri, or where that is located. I thought it is the same as a callback url in my website? I guess not. I did replace with `'/v1/marketplaces/TEST-MP4IaoKYeyteVLTY0nphZijM'` which resolved this specific error. On to the Fiddle, thank you again @Mahmoud. – TARKUS Nov 30 '13 at 13:16
  • 3
    If you have your secret key you can do: `curl -u ${SECRET_KEY}: https://api.balancedpayments.com/v1/marketplaces` and that should return everything about your marketplace. The callback URL is just something that we will hit when any events are created on your marketplace. – Mahmoud Abdelkader Nov 30 '13 at 20:21
  • Thanks for that. I'm getting valid response.data now, in both credit card and bank account test calls, using the balanced.bankAccount and balanced.card objects. – TARKUS Nov 30 '13 at 22:08