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 09-24-2014, 04:10 PM
Nes's Avatar
Nes is offline
Junior Member
 
Join Date: Sep 2014
Posts: 1
Question

Get OrderID With Javascript API


I am trying to use the javascript API to get the order number after checkout. Based on the documentation, orderId should be available when page.type is "CHECKOUT_RESULT". However, that is never happening. The workflow goes from
"CHECKOUT_PLACE_ORDER_EXTERNAL" or "CHECKOUT_PLACE_ORDER"
to "ORDER_CONFIRMATION" where the order id is not available.
Am I missing something?

Code:
Ecwid.OnPageLoaded.add(function(page){

  ...

  } else if(page.type == "CHECKOUT_RESULT"){ // never called
    console.log(page.orderId)

  }
});
Thanks
  #2  
Old 10-02-2014, 07:29 AM
Rick G's Avatar
Rick G Rick G is offline
Ecwid Team
 
Join Date: Jun 2014
Posts: 1,271
Default

Quote:
Originally Posted by Nes View Post
I am trying to use the javascript API to get the order number after checkout. Based on the documentation, orderId should be available when page.type is "CHECKOUT_RESULT". However, that is never happening. The workflow goes from
"CHECKOUT_PLACE_ORDER_EXTERNAL" or "CHECKOUT_PLACE_ORDER"
to "ORDER_CONFIRMATION" where the order id is not available.
Am I missing something?

Code:
Ecwid.OnPageLoaded.add(function(page){

  ...

  } else if(page.type == "CHECKOUT_RESULT"){ // never called
    console.log(page.orderId)

  }
});
Thanks
Hi,

You can get the internal order ID (that is not visible to the customer or merchant and is intended for logs), using Javascript API. In order to do that, the type of the page has to be CHECKOUT_RESULT. This type of page appears for a short period of time after a user returns from a successful attempt to purchase something from your store through online payment gateway, like Paypal, etc.

I talked to our developer team and we decided to add orderId to the cart object. The orderId element will contain the internal orderId. This way it will be easily accessible for Ecwid users, who need to get the internal orderId.

It will take some time for us to change the Javascript API, so I will inform you when the changes will be applied.

If you want to get the general order ID that is visible in your order history, on a thank you page or other places you can use our Order API for that.

If you have any further questions, please don't hesitate to ask.
Thank you.
__________________
Ecwid API and App Market Team
Ecwid Developer Website
  #3  
Old 06-25-2015, 12:22 PM
Rick G's Avatar
Rick G Rick G is offline
Ecwid Team
 
Join Date: Jun 2014
Posts: 1,271
Default

Hello everyone,

We have updated Ecwid Javascript API and now you can get the order number that you see in your Sales records in Ecwid control panel using the following field:

- orderNumber – order number for the order without prefix and suffix
- orderVendorNumber - order number for the order with prefix and suffix

These two fields are now available in the Page object of our Ecwid Javascript API.

Thank you.
__________________
Ecwid API and App Market Team
Ecwid Developer Website
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
orderid

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 05:05 PM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.