The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 02-27-2014, 12:58 AM
AdamLang's Avatar
AdamLang is offline
Junior Member
 
Join Date: Oct 2012
Posts: 5
Default

Three javascript questions


Short and sweet:

1) Is there any way, using the javascript API, to add a unique (string) identifier to a shopping cart that can be viewed in the ecwid control panel? Aside from adding a $0 item to the cart, which I suspect would fail, if it were done after the user had already started checking out.

2) Is the 'orderID' from the Page object anything that I can understand/look up later/find in my control panel order pane, or is it solely available to me via the javascript API during that transaction?

3) Is it possible to do anything dynamic within the payment methods instructions? I.e. insert a unique 'wallet' address, insert a dynamically calculated amount, etc. I tried putting a named span in it and inserting into that, but it appears that the text within is not just invisible, it's not present until that payment method radio button has been chosen, and I don't see any callbacks that I can register for that would fire when that radio button gets clicked.

I am trying to set up an ecwid site to take dogecoin, and while quite possible, it's somewhat awkward for both myself and my users.
  #2  
Old 02-27-2014, 07:10 AM
AdamLang's Avatar
AdamLang AdamLang is offline
Junior Member
 
Join Date: Oct 2012
Posts: 5
Default Answering myself

Well, I appear to have some answers for myself.

1) If there is, it's undocumented.

2) It doesn't matter: if you are using a custom payment type that doesn't automatically get approved, then you will never see the 'CHECKOUT_RESULT' page at all, which means that orderId will never be defined. There is also no way to retrieve someone's email address without them being logged in, which nobody EVER does at my store... no way, in fact, to identify a given purchase uniquely from the Javascript API at all.

Still not sure about 3, but 1 and 2 appear to mean that there is literally no way to set up a dogecoin wallet address for each user, have people transfer their purchase price to it, and then get a notification with that wallet address AND some way to tell what transaction it was attached to, without having them enter their email address twice or something graceless like that.
  #3  
Old 03-06-2014, 10:33 AM
Maya's Avatar
Maya Maya is offline
Ecwid Team
 
Join Date: Feb 2010
Location: Ecwid headquarter
Posts: 5,876
Default

Hello,

Sorry for delay with answer.

Quote:
1) Is there any way, using the javascript API, to add a unique (string) identifier to a shopping cart that can be viewed in the ecwid control panel? Aside from adding a $0 item to the cart, which I suspect would fail, if it were done after the user had already started checking out.
Ecwid has several different APIs that allow you to get the list of products and update it (see Product API), get the list of store orders and several others (http://kb.ecwid.com/w/page/25232810/API). Unfortunately, none of these APIs doesn't allow to affect on Ecwid control panel and, moreover, add custom fields to the product.
In fact, Ecwid allow to add to the cart products with $0.00 price, so you can place zero-order without any problems, actually. In additional to that you can enable option (Ecwid control panel -> System Settigns -> General -> Cart -> "Skip payment method selection, if order total is zero") that will skip billing stage when orders total is zero and set order's status to "Accepted" automatically.
Thus, you can "sell" free products in your store without any additional adjustments.

Quote:
2) Is the 'orderID' from the Page object anything that I can understand/look up later/find in my control panel order pane, or is it solely available to me via the javascript API during that transaction?
Order ID is unique order identifier. You can find Order by it's ID in Ecwid control panel -> Sales -> Orders list.

Quote:
3) Is it possible to do anything dynamic within the payment methods instructions? I.e. insert a unique 'wallet' address, insert a dynamically calculated amount, etc. I tried putting a named span in it and inserting into that, but it appears that the text within is not just invisible, it's not present until that payment method radio button has been chosen, and I don't see any callbacks that I can register for that would fire when that radio button gets clicked.
You can add instruction for your payment method in Ecwid control panel -> System Settings -> Payment page. Just click "Instruction for customers" link near the payment method name and enter any text you need in appeared popup window. You can add some instruction how to pay using this method or add your wallet number or anything else. All this info will be shown in instruction block automatically, when this payment method is chosen.

If you have any other questions, please, feel free to ask.
__________________
Maya N., Ecwid Team

------------------
Welcome to our new Help Center!
  #4  
Old 03-07-2014, 10:57 PM
AdamLang's Avatar
AdamLang AdamLang is offline
Junior Member
 
Join Date: Oct 2012
Posts: 5
Default

You can add instruction for your payment method in Ecwid control panel -> System Settings -> Payment page.

Yes, I realize that, thanks. That's why I said 'anything dynamic'. Something such as the price of the things currently in the cart as calculated externally in dogecoins (a bitcoin parody/alternative), or a unique dogecoin address set up for that particular customer to send their payment to.

Right now, here is my current solution:
1) Create a $0 item called 'wallet identifier'. Put it in a disabled category so it isn't visible to users.

2) Set up a payment of type 'dogecoin', based on type check. Put instructions in that say, 'Go look at the bottom of the page for the wallet ID to send your payment to and the exact amount of dogecoin to transfer.'

3) When a user visits my page, upon ecwid API initialization, use an external API at dogeapi.com to create a unique wallet ID for that user to send to. Display it in the test of the web page in which the store is embedded, and hang onto it in a variable.

4) Upon every cart update event, recalculate the price of the full cart in dogecoins (via another call to dogeapi.com) and print that on the page near the wallet ID.

5) When the user goes to check out, watch to see if the payment type changes to 'dogecoin'. If it does, add a 'wallet identifier' item with two string options, one containing the last calculated amount of dogecoins and the other containing the wallet ID. But only add this if there is not already an order identifier with that wallet ID in the user's cart.

Here are the problems:
1) Occaisonally the user clicks through the final two pages too quickly for the item to be added to the cart, so there is no wallet ID item at all. It takes a while to add an item to the cart, and there is only one screen after the payment type is changed in which to do it.

2) The instructions are not very good, because it would be a lot better to have the wallet ID and amount actually embedded in the instructions. However, I don't know of a way to do this, since javascripts embedded in there either don't run or don't seem to have access to the page's global variables.

3) Sometimes the user ends up with two or more wallet IDs in their cart, and there is no way to remove the incorrect one. (This happens if they reload the page, or if they cancel out and change the payment type back to paypal and then back to dogecoin again.)

In summary: it works, but only barely, and only sometimes. Not great.

If there were a way to remove items from shopping carts via javascript, and there were a way to run javascripts and access javascript global variables in the payment instructions screen, it would be a good deal smoother.
  #5  
Old 03-12-2014, 01:35 PM
Maya's Avatar
Maya Maya is offline
Ecwid Team
 
Join Date: Feb 2010
Location: Ecwid headquarter
Posts: 5,876
Default

Hello,

Thank you for the detailed explanation of your project.

If I understood you properly, you are trying to add custom Dogecoin payment method to your Ecwid store.

In fact, Ecwid provide the easier and more convenient way of custom payment gateway integration. In order to add custom payment gateway to Ecwid you can use our Custom Payment Gateway API. Please, refer to this article for details: http://kb.ecwid.com/w/page/49187841/...aymentgateways

Good luck!
__________________
Maya N., Ecwid Team

------------------
Welcome to our new Help Center!
  #6  
Old 03-12-2014, 05:16 PM
AdamLang's Avatar
AdamLang AdamLang is offline
Junior Member
 
Join Date: Oct 2012
Posts: 5
Default

I understand that I could use the custom payment API. However, since I make an average of $5 off my store per month, I can't really justify a paid account at this time. Thus, I must make do with the Javascript API.

Thanks!
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
dogecoin, javascript api

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:16 AM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.