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 NameDiscussion

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

ec.downloadTitle()

ec.checkFirmware()

ec.generateKeyPair() šŸ”’ Requires HTTPS

Returns -4002 - possibly not implemented, or deprecated?

ec.confirmKeyPair() šŸ”’ Requires HTTPS

Returns -4002 - possibly not implemented, or deprecated?

ec.checkRegistration()

Makes a request via ECS for the CheckRegistration type.

ec.register(challenge) ec.register(challenge, extAccountId) ec.register(challenge, extAccountId, extAccountPassword) šŸ”’ Requires HTTPS

Performs a request to register this console to the server. It is possible to override sent credentials while registering, as during a re-register configured credentials from ec.cfg will be sent.

ec.transfer() šŸ”’ Requires HTTPS

ec.syncRegistration() šŸ”’ Requires HTTPS

Syncs the registration state of this console, seemingly updating token, serial number, friend codes, and other values as appropriate.

ec.sendChallengeReq() šŸ”’ Requires HTTPS

Requests a challenge from the configured IAS server.

ec.getChallengeResp() šŸ”’ Requires HTTPS

Retrieves the returned challenge from the given IAS server.

ec.reportCSS() šŸ”’ Requires HTTPS

ec.confirmCSS() šŸ”’ Requires HTTPS

ec.getCSSConfirmation()

ec.getTitleInfo(titleId)

Returns an ECTitleInfo for the specified title ID.

ec.getTitleInfos()

Returns an ECTitleInfos for all available titles on the console.

ec.getTicketInfos(titleId)

Returns an ECTicketInfos for the given title ID.

ec.getDeviceInfo()

Returns an object you can use to access information with. See its dedicated page, ECDeviceInfo, for more information.

ec.setWebSvcUrls(ecs) ec.setWebSvcUrls(ecs, ias) ec.setWebSvcUrls(ecs, ias, cas)

Sets endpoints for usage.

  • ecs: The ECommerceSOAP endpoint, utilized for requests related to titles and purchases.

  • ias: The IdentityAuthenticationSOAP endpoint, utilized for identity and registration-related requests.

  • cas: The CatalogingSOAP endpoint, utilized for listing available titles (such as for DLCs or service titles).

CAS is not used within the Wii Shop Channel - only used in other ECDK-utilizing titles, such as for DLC content.

ec.setContentUrls(ccs) ec.setContentUrls(ccs, ucs)

ccs appears to be an http URL by default, presumably meaning "cached contents". ucs may mean "uncached contents", using an https URL.

ec.checkParentalControlPassword(pin)

Validates the given Parental Control PIN/password as a long. If this is disabled, it returns -4075, or -0xfeb.

ec.launchTitle(titleId, ticketId)

Launches the passed title with the given ticket.

ec.request(requestString)

Requests something, with a callback. **TODO**

ec.getWeakToken() šŸ”’ Requires HTTPS

ec.startLog() šŸ”’ Requires HTTPS

Creates a new logging buffer.

ec.stopLog() šŸ”’ Requires HTTPS

Destroys the present logging buffer.

ec.getLog() šŸ”’ Requires HTTPS

Returns a string with the internal held log from buffer.

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 NameDiscussion

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 updated