ECommerceInterface
The main interface to interact with EC
You use the ECommerce set of classes when you want to deal with the underlying EC APIs. With EC, you handle things such as title management and payment information. And you also have the option to handle components such as device information, permitting identification of the console in several ways.
For every page, you'll want to initialize the ECommerceInterface type.
var ec = new ECommerceInterface();
This special type inherits from ECGenericObject, an internal C++ type that many others use as a parent. You should only create this specific object type once per page load in JS, as it calls the special function EC_Init internally.
Inside of EC, there is a JS "test mode" that allows modification of objects that are normally not modifiable via JS. It is not possible to enable it beyond binary patching, or editing memory.

Members

Member Name
Discussion
ec.getVersion()
Returns the EC library's version number. As of the Wii Shop Channel v21, this is 264192, or 0x40800.
ec.setParameter(name, value)
Sets multiple internal EC library values. Known names are:
  • TIN: a unique title number within games.
  • AppId: the current running title ID.
  • PCPW: Parental Control pin/password.
  • USE_NCRS: (unknown, accepts 0/1)
  • SPACE_CHECK_POLICY:with a value of SPACE_CHECK_USER_ONLY or SPACE_CHECK_ENTIRE_FS.
This calls EC_SetParameter internally. The Wii Shop Channel does not set a TIN as many games might.
ec.getSessionValue(name)
For the current EC object, get a value for the given name from an internal store. This key will persist within the internal store for the duration of the channel's runtime.
ec.setSessionValue(name, value)
Sets the key for name to value within the internal store.
ec.getPersistentValue(name)
Obtains a value by name from ec.cfg.
ec.setPersistentValue(name, value)
Sets a key by name to value in ec.cfg.
ec.getProgress()
Returns an ECProgress object on the state of the given operation, or the most recent operation. Returns -4007 if no operation is ongoing.
ec.cancelOperation()
Cancels the current operation.
ec.purchaseTitle(titleId, itemId, price, payment, limits, downloadContent, taxes, purchaseInfo, discount) πŸ”’ Requires HTTPS
Formulates and sends a PurchaseTitle request, typically used with payment. Parameters are as follows:
  • titleId: the title ID to purchase, as a string.
  • itemId: Unknown.
  • price: An instance of ECPrice.
  • limits: An instance of ECTitleLimits. It's acceptable to have this be zero in length.
  • downloadContent: A boolean on whether the title should be downloaded .
  • taxes (optional): A string seemingly holding the price calculated for taxes. It's unclear on how this would be used.
  • purchaseInfo (optional): Unknown string value.
  • discount (optional): Unknown string value.
ec.purchaseGiftTitle(titleId, itemId, price, payment, limits, identifier, identifierKind, notes, taxes, purchaseInfo) πŸ”’ Requires HTTPS
​
Formulates and sends a PurchaseTitle request, typically used with payment. Parameters are as follows:
  • titleId: the title ID to purchase, as a string.
  • itemId: Unknown.
  • price: An instance of ECPrice.
  • limits: An instance of ECTitleLimits. It's acceptable to have this be zero in length.
  • identifier: An identifying value for the recipient console, such as its Wii friend code.
  • identifierKind: The type of identifying value.
  • notes (optional): Potentially a note for the recipient, unknown.
  • taxes (optional): A string seemingly holding the price calculated for taxes. It's unclear on how this would be used.
  • purchaseInfo (optional): Unknown string value.
  • discount (optional): Unknown string value.
ec.acceptGiftTitle(titleId, transactionId, accept, reason, downloadContent)
πŸ”’ Requires HTTPS
Accepts, or rejects, a gifted title.
  • titleId: the title to accept.
  • transactionId: The recipient's transaction ID, sent via query parameters in the sent Wii Mail.
  • accept: Whether this gift was accepted (true) or rejected (false).
  • reason (optional): Seemingly a string as to why. It's unclear on where this is sent.
  • downloadContent (optional): Whether to download this title upon acceptance.
ec.unregister(challenge) πŸ”’ Requires HTTPS
Performs a request to unregister this console from the server. As part of EC_Unregister, this may mean NAND titles and tickets are deleted. The challenge parameter is typically obtained from issuing a call to ec.sendChallengeReq(), awaiting its completion, and utilizing the result from the server via ec.getChallengeResp(). However, the client does not enforce a challenge is ever called. It is safe to use any value desired.
ec.deleteOwnership(titleId, ticketId) πŸ”’ Requires HTTPS
Deletes the local copy of this ticket, and additionally registers with the server that a ticket has been deleted for the given titleId and ticketId.
ec.syncTickets(type)
Sends a list of local tickets on the console, and reads a list of tickets from the server The parameter type is optional, and defaults to zero. It is unknown what other sync types are available.
ec.checkDeviceStatus()
Synchronizes values such as ticket sync times and point balances.
ec.refreshCachedBalance()
Requests the console's current points balance.
ec.getCachedBalance()
Returns the current cached points balance.
ec.getPurchaseInfo()
​
ec.getTransactionInfos()
Retrieves transaction history from the server, returning an ECTransactionInfos object.
ec.purchasePoints() πŸ”’ Requires HTTPS
​

JS Test Mode Operations

These following functions do not function without the JS test mode being enabled via binary patching. They will log such if called. Do not expect them to work.
Member Name
Discussion
ec.setLanguage(language)
Overrides the configured language for this EC object.
ec.setCountry(country)
Overrides the configured country for this EC object.
ec.setRegion(region)
Overrides the configured region for this EC object.
ec.setAge(age)
Overrides the configured age for this EC object.
ec.setAccountId(accountId, deviceToken)
Overrides the configured account ID for this EC object. If a constructor parameter is not specified as a string, it will default to the string literal null.
ec.deleteTitleContent(titleId)
Deletes a title's contents from the console.
ec.deleteTitle(titleId)
Deletes a title's contents and data from the console.
ec.deleteLocalTicket(titleId, ticketId)
Deletes a title's contents, data, and ticket from the console.
ec.pubKeyEncrypt(message)
Encrypts a message with the console's public key, returning a base64-encoded string of the encrypted contents.
ec.runTests()
Unknown. Appears to return zero.
ec.setOption(option, value) πŸ”’ Requires HTTPS
Sets an option within EC. Only two options are accepted:
  • 0: Sets the JS test mode, where value is a boolean.
  • 1: Adjusts the log level is adjusted to that of value.
All other options appear to return -4004, or 0xfa4.
Last modified 4mo ago