2. Communication With the Nintendo eShop Server

This chapter describes the communication that takes place between the Nintendo eShop ("eShop") server and the independent server. For information about communication between the client and the independent server, see Communication With Clients.

2.1. Overview

2.1.1. Using the eShop REST API

The eShop REST API is provided as a Representational State Transfer (REST) API. Properties such as title information, service item information, and user information are expressed as resources. To get a resource's information, send an HTTP GET request to a URL, and include the resource name and a resource identifier.

To execute service item purchases and other non-read functions, send an HTTP POST request. When doing so, set the request parameters in the body. Percent-encode the request as described in RFC 3986. Only UTF-8 can be used for the character encoding.

Note:

When sending a request, the Content-Type header value must be set as follows.

application/x-www-form-urlencoded; charset=UTF-8

2.1.2. eShop REST API Resources

The eShop REST API provides the following resources (shown as a hierarchical structure).

  • https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs
    • Accounts (/accounts)
      • Balance (/balance)
      • Rights (/rights)
      • Transactions (/transactions)
    • Titles (/titles)
      • Items (/items)
        • Prices (/price)

The hostname depends on the server environment name and the client platform name.

Replace (server_env) with the server environment name. For more information, see 2.1.14. Connecting to the Development and Production Environments.

Replace platform_name with the client platform name. Use ctr if the client is part of the 3DS family, and wup if the client is a Wii U.

Note:

The hostname and context root may change.

2.1.3. Authentication

2.1.3.1. Authentication Between the Independent Server and eShop REST API

To use the eShop REST API from an independent server, perform the following two-factor authentication.

  • Independent Server Authentication
    • Use SSL with client authentication to authenticate the independent server. Authenticate the independent server and encrypt the data.
    • To generate a client certificate, generate a key pair and submit the PEM-formatted certificate signing request (CSR) to the Online Title Management Server (OMAS). Use RSA public-key encryption with a key length of 2048 bits.
    • Use a unique proper noun as the certificate subject (common name), such as the title or the publisher. (Avoid names that are likely to overlap with other names, such as "Test cert.")
    • The certificate authority operated by Nintendo will sign and issue a certificate for the CSR you submitted to OMAS. This certificate will be released on OMAS. Use it to configure your independent server.
    • When Nintendo carries out Lotcheck, the independent server's client certificate used must be compatible with environment names that include service tokens received from the application. For information about environment name and client certificate support, see 2.1.14. Connecting to the Development and Production Environments.
  • Title Authentication
    • Independent servers can host services for multiple titles, so titles must be authenticated to prevent other title information (such as item lists) from being accessed inadvertently.
    • Use basic authentication with title codes and TINs to authenticate a title. Use the title code as the user name and the TIN as the password to generate an authentication header, and then set this header in all requests, using the following example.
      • Example:
        Host: https://akindo-d1.ctr.shop.nintendo.net/akindo/rs
        Authorization: Basic [authentication header generated from title code and TIN]
    • The eShop REST API returns HTTP/1.1 401 Authorization Required if the authentication header is not set or if the title code and TIN combination is invalid.
    • For more information about title codes, see the title code description. You can access TINs from the relevant title pages on OMAS.

This two-factor authentication is applied to all requests made to the eShop server.

Note:

When submitting the CSR to OMAS, set different common names for the development and production units. Contact Nintendo if you would like to use the same common name for both development and production units.

Note:

After the CSR is submitted to OMAS and a certificate is issued, set a common name on IMAS. Specify that setting on the Service Title Details page, in Client Certificate Subject for Development (Production) Environment. Note that a failure to specify this setting correctly will result in being unable to use the eShop REST API.

2.1.3.2. Authentication Between the Game Application and the Independent Server

A service token acquired from the account server is included in communication between the game application and the independent server, ensuring encrypted communication using SSL. Use the CA of your choice for signing the certificate. We recommend RSA 2048-bit public-key encryption.

Account IDs and principal IDs on different account servers may conflict. To identify a Nintendo network account on an independent server, make sure that you use a unique ID based on a combination of the account server environment name and the principal ID. Do not use only the principal ID. For more information, see the Wii U Account System Developer's Guide.

Note:

The following are examples of the account server environments.

  • D1 through D8: Development environment
  • L1 through L9: Production environment
  • S1 through S9, D9: Lotcheck environment

The environment name is a combination of one uppercase letter (A-Z) and one number (0-9). For example: L1. Make sure that an application can support any possible combination without problems.

2.1.4. Service Tokens

To use the eShop REST API, depending on the use, get one of the following two service tokens from the account server.

Independent Server Service Token

The functions provided by the eShop REST API require a principal ID to identify the user. You can get the principal ID by decrypting the service token obtained from the account server on the independent server.

To prevent spoofing and other security risks, make sure that you get the principal ID from the service token. For more information about decrypting service tokens and the information that they contain, see the Wii U Account System Developer's Guide. 

Service tokens do not expire and there are no limits on the number of times they can be used, but you can configure an expiration according to the independent server's policy. If an expiration is configured, check for an expiration based on the token date of issue contained in the service token. If your independent server consists of more than one server machine, you can also share tokens between servers.

EC Service Token

Some of the functions in the eShop REST API require an EC service token. When you call one of these functions, you must get an EC service token from the dedicated function in the account library API and send it to the independent server.

Do not cache the EC service token in the independent server. Get a new one from the account server every time one of these functions is called.

2.1.5. Restricting the Volume of API Requests

Although there is currently no explicit limit on the volume of calls that can be made to the API, whenever possible avoid practices such as getting license information periodically after the user starts the game.
We recommend that you only get license information when the user uses an item or service (that is, when it is necessary to check for a license).

2.1.6. Timeout Period

Each of the eShop REST API functions times out and returns an error (one of the HTTP status codes ranging from 500 to 599) if it cannot return a response within 60 seconds from the time the request is received.
However, because the actual timeout error is not strictly returned after 60 seconds, configure the independent server to check for timeouts after a slightly longer period (for example, approximately 90 seconds).

Note:

The timeout period was set to 150 seconds. It was changed to 60 seconds as of the server update in November 2015.

2.1.7. Functionality When the eShop Is Under Maintenance

2.1.7.1. API Functions Available During Maintenance

Part of the eShop REST API is not available while the eShop is under maintenance. The following functions are available during maintenance.

  • Listing items
  • Getting the account balance
  • Getting license information
  • Getting purchase history
  • Getting payment status
  • Getting messages for a declaration based on law (Wii U only)
  • Getting a list of recurring billing items
  • Getting recurring billing items currently under contract

If you try to execute any other function during maintenance, an error code is returned indicating that the eShop is under maintenance.

2.1.7.2. Connecting to a Different Server During Maintenance

While the eShop is under maintenance, the IP address of the eShop REST API changes.

In this documentation, the server connected to during non-maintenance periods is referred to as the primary, and the server connected to during maintenance is referred to as the secondary. For example, during eShop maintenance, the destination REST API switches to the secondary.

The eShop switches to the secondary as follows.

  1. The primary returns an error code if any API function is called other than the ones listed in 2.1.7.1. API Functions Available During Maintenance.
  2. The DNS that manages the nintendo.net zone returns the secondary IP address for akindo(-server_env).platform_name.shop.nintendo.net.
  3. Access to the primary is blocked.
Figure 2-1. Steps for Switching Servers During Maintenance

When also connected to the secondary, the server returns an error code if any API function is called that is other than those in 2.1.7.1. API Functions Available During Maintenance.

The switch to the new destination IP address is made by the public DNS provided by Nintendo, which manages the nintendo.net zone.
Use a full-service resolver (personal or one provided by your ISP) to connect to the eShop REST API.

There is a delay of at least 10 minutes between executing steps 2 and 3. However, we recommend setting the DNS cache expiration according to the TTL specified by the DNS provided by Nintendo.

After maintenance ends, the eShop switches back to the primary as follows.

  1. Maintenance ends.
  2. The DNS that manages the nintendo.net zone returns the primary IP address for akindo(-server_env).platform_name.shop.nintendo.net.
  3. All API functions can be called on the primary.

2.1.8. Title Code

The eShop REST API uses the title code as the game title identification ID.

For example, when listing items, specify the title code to get a list of items related to that title. The title identifier included in the authentication header, when authenticating titles, also uses this title code.

Wii U Titles

Specify the title codes for Wii U titles in the following format.

1 + [unique ID] + 00 (8-digit hexadecimal)

For example, with a unique ID of D0001, the title code would be 1D000100.

3DS Titles

Specify the title codes for 3DS titles in the following format.

0 + [unique ID] + 00 (8-digit hexadecimal)

For example, with a unique ID of D0001, the title code would be 0D000100.

2.1.9. Time Zone of the Time Returned by the Server

Times returned by the server are in the UTC time zone, and follow the ISO 8601 format. (For example, 2012-06-05T11:22:33Z.)

2.1.10. Character Encoding Used by the eShop REST API

The character codes for all eShop REST API requests are handled in 8-bit UCS (Unicode) Transformation Format (UTF-8). All responses are handled the same way.

2.1.11. Currency Codes Used by the eShop REST API

The eShop REST API uses the currency codes stipulated by ISO 4217.

2.1.12. Language Codes Used by the eShop REST API

The eShop REST API uses the two-letter language codes stipulated by ISO 639.

2.1.13. Rules for Language Use

All currency denominations in responses from the API are formatted according to the language. If you specify a language code in a call to the API, the response is formatted in accordance with that language.

Conversely, if you omit the language code, the response is formatted for the language used by the user to access Nintendo eShop. Note that if a country supports more than one language, the language in the system settings may not always match with the language used to access Nintendo eShop.

Note:

When it is necessary to display currency notations to the user, provide that user's System Settings language as a parameter when carrying out each API.

This step prevents the display of currency notations that are formatted using an encoding that differs from the one configured in System Settings by the user.


2.1.14. Connecting to the Development and Production Environments

The development, Lotcheck, and production environments are separated by their FQDN.

The FQDN must include the server environment name and the platform name, as follows.

akindo(-server_env).platform_name.shop.nintendo.net

For the server environment name, use the value obtained when decrypting the service token obtained from the account server. For the platform name, use ctr if the client is part of the 3DS family, and wup if the client is a Wii U.

Examples for each environment follow.

  • Development environment (Access is allowed with client certificates for development.)
    • akindo-d1.ctr.shop.nintendo.net
    • akindo-d1.wup.shop.nintendo.net
  • Lotcheck environment (Access is allowed to s1 through s3 with client certificates for development, and to s4 through s6 and d9 with client certificates for production.)
    • akindo-s1.ctr.shop.nintendo.net
    • akindo-s1.wup.shop.nintendo.net
    • akindo-s4.ctr.shop.nintendo.net
    • akindo-s4.wup.shop.nintendo.net
    • akindo-d9.wup.shop.nintendo.net (The use of the D9 environment is restricted to Wii U.)
  • Production environment (Access is allowed with client certificates for production.)
    • akindo-l1.ctr.shop.nintendo.net
    • akindo-l1.wup.shop.nintendo.net
Note:

The North American and European Lotchecks are divided into two stages.
Use the S1 to S3 server environments for the first stage, and the S4 to S6 and D9 server environments for the second stage.
When performing the independent server authentication described in 2.1.3.1. Authentication Between the Independent Server and eShop REST API, switch the client certificate to be used by basing it on the server environment name.

Note:

A title that already use a FQDN that differs from the ones described previously can continue to use that FQDN.

Note:

The Lotcheck environment cannot be used until Lotcheck begins.

2.1.15. License Types

The eShop REST API can issue the following three types of licenses (called tickets).

Table 2-1. License Types and Descriptions
  License Type     Descriptor     Description  
Subscription ticket ADDITIONAL TIME Expresses the time until the item expires in epoch seconds (seconds since 00:00:00 UTC, January 1, 1970).
Consumable ticket CONSUMPTION Expresses the number of times that the item can be used. The independent server must manage the number of uses that have been consumed.
Permanent ticket PERMANENT Expresses a license that can be permanently used with the item.

2.1.16. Response

2.1.16.1. Response Format

The eShop REST API provides XML and JSON response formats. Specify the response format by specifying a content type in the Accept header of your request.

To receive responses in JSON format, you can use either application/nintendo-eshop-format-v2.0+json or application/json. application/json is the old format. The current recommendation is to use application/nintendo-eshop-format-v2.0+json.

Table 2-2. Response Formats
Accept Header Value in Request Content Type of Response
None application/xml
application/xml application/xml
application/nintendo-eshop-format-v2.0+json application/json
Note:

If the response format is set to the old JSON format, elements composed entirely of numerical values, such as raw_value, will not be returned in double quotation marks. For this reason, when results containing a decimal point are returned, they are handled using a data type such as a float value, and if the value is included in a request, it may result in an error.

On independent servers, ensure that issues due to use of an unintended data type (such as handling values as strings) do not occur.

2.1.16.2. Root Element of the Response

The root element of all eShop REST API responses is <eshop>.

2.1.16.3. Version

The version number of the eShop API is included in all eShop REST API responses.

Code 2-1. Version Example
0001  <eshop>
0002    <version>1.0</version> 
0003    :
0004  </eshop>

2.1.16.4. Reference ID

The reference ID is an ID for uniquely identifying an item for sale. It is defined on the independent server side. Use 32 hexadecimal characters for the reference ID.

The reference ID returned in the response from the eShop REST API is entirely in lowercase letters. Note that the reference ID in the response is entirely in lowercase even if it was set using uppercase in the request.

2.1.16.5. Errors

If an eShop REST API function fails, it returns error information as the response. Error information consists of an error code.

Although the implementation of error handling is generally handled by the independent server, if an error code is listed in the e-commerce guidelines provided by Nintendo, we ask that you display it in the client application using the error viewer.

Error Code Format

109-xxxx (where "xxxx" is a 4-digit decimal number)

Code 2-2. Example of Error Information
0001  <error>
0002    <code>109-1111</code>
0003  </error>

2.1.16.6. Correlation ID

A unique correlation ID is included in all eShop API responses. If errors occur, include this ID when contacting Nintendo with any inquiries.

Code 2-3. Example of Correlation ID
0001  <correlation_id>cor112358132134</correlation_id>
Note:

To check the detailed settlement information, contact Nintendo with the PID and ext_transaction_id.

2.2. API Reference

Note:

As indicated in 2.1.14. Connecting to the Development and Production Environments, the FQDN for your request target must be set to match the server environment and platform. The code samples within this API reference are configured, with some exceptions, for the CTR (3DS) platform's D1 environment.

As appropriate, change the target platform and environment such that it can be referenced.

2.2.1. Basic API

2.2.1.1. Listing Items

Overview

Gets a list of subscription tickets or consumable items defined by the game title that has the specified title code.

The independent server then generates the item list that is ultimately shown to the user, using the item codes to match items on the item list maintained on the independent server with the items in the item list obtained by using this API.

If the number of items is large, you can restrict the number of items obtained by specifying an offset value and the maximum number in the list. The items obtained in the item list are only those items currently sold in the country that is set for the specified Nintendo Network account. Items that are planned for sale, or for which sales have already ended, are not included in the list.

Example of Item List Display

The item list obtained from an independent server and the eShop REST API has the following appearance.

Table 2-3. Example of the Item List Managed by the Independent Server
Reference ID Item Code Item Name Displayed to User
ref101 item101 Super Mushrooms
ref102 item102 Super Flowers
ref102 item103 Super Flowers
ref103 item103 Super Stars
ref104 item104 Super Poison Mushrooms
Table 2-4. Example of the Item List Obtained Using This API
Item Code Use Limit Retail Price Item Attributes
item101 2 time 100 yen  
item102 4 time 150 yen  
item103 6 time 200 yen  
item104 1 time 300 yen Initial purchase only.

If the user already has rights to use the Super Poison Mushrooms, the following item list is displayed.

Table 2-5. Example of Item List Displayed to User
Item Name Displayed to User Use Limit Retail Price Purchase Status
Super Mushrooms 2 time 100 yen  
Super Flowers 4 time 150 yen  
Super Flowers 6 time 200 yen  
Super Stars 6 time 200 yen  
Super Poison Mushrooms 1 time 300 yen Purchased.

Item Listing Process

When communicating with the independent server, the application must get a token called a service token from the account server. For more information, see Independent Server Service Tokens in 2.1.4 Service Tokens.

The process for listing items follows.

Figure 2-2. Item Listing Process

 

Request

Table 2-6. Parameters
Parameter Optional Description
pid No Principal ID for the Nintendo Network account. Use the value obtained from the service token received from the client.
title_code No Title code identifying the game title (8-digit hexadecimal).
lang Yes Language configured in System Settings. Use the language code received from the client. Used to determine the currency notation format. Also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified Nintendo Network account.
offset Yes Offset for getting service items from the search results that match the filter.
limit Yes The number of service items to get as a search result. (Set to a default of 50 when omitted.)
Code 2-4. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/$title_code/items?lang=$lang&pid=$pid&offset=$offset&limit=$limit
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/titles/1D000100/items?lang=en&pid=pid100001&offset=0&limit=20

Response

Node

  • items: Root node for the service items list.
    • total: Total number of service items matching the search.
    • length: Number of service items included in this response.
    • offset: Offset.
    • item: Service items.
      • item_code: The item code for this item.
      • price: The price for this item.
        • regular_price: The retail price of this item. (Whether tax is included depends on the country.)
          • amount: The retail price formatted for the currency (for example, $10.00).
          • currency: The currency code defined by ISO 4217 (for example, USD).
          • raw_value: The unformatted retail price (for example, 10).
      • tax_excluded: If true, tax is excluded; if false, tax is included. Used to determine whether the price for the relevant item is shown as excluding or including tax when showing the item list.
      • initial_purchase_only: If true, the user cannot purchase an item if the user already has rights to that item's reference ID. It is apparent whether the item for a reference ID can be purchased because rights information is included in the item list.
      • limit: License information for this service item.
        • type: License type for this service item.
        • value: Value corresponding to the license for this item (limited period of time, limited number of times). If the license type is unlimited, this value does not exist.
      • attributes: List of item attributes.
        • attribute: Item attribute.
          • name: Attribute name.
          • value: Attribute value.
Code 2-5. Sample Response From the Item List API
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <items>
0005      <total>30</total>
0006      <length>2</length>
0007      <offset>0</offset>
0008      <item>
0009        <item_code>item100001</item_code>
0010        <price>
0011          <regular_price> 
0012            <amount>$10.00</amount>
0013            <currency>USD</currency>
0014            <raw_value>10</raw_value> 
0015          </regular_price> 
0016        </price>
0017        <tax_excluded>true</tax_excluded>
0018        <initial_purchase_only>true</initial_purchase_only>
0019        <limit>
0020          <type>ADDITIONAL TIME</type>
0021          <value>3600</value>
0022        </limit>
0023        <attributes>
0024          <attribute>
0025            <name>item_attribute_name</name>
0026            <value>some item name1</value>
0027          </attribute>
0028        </attributes>
0029      </item>
0030      <item>
0031        <item_code>item100002</item_code>
0032        <price>
0033          <regular_price>  
0034            <amount>$10.00</amount> 
0035            <currency>USD</currency>
0036            <raw_value>10</raw_value> 
0037          </regular_price> 
0038        </price>
0039        <tax_excluded>true</tax_excluded>
0040        <initial_purchase_only>true</initial_purchase_only>
0041        <limit>
0042          <type>CONSUMPTION</type>
0043          <value>1</value>
0044        </limit>
0045        <attributes>
0046          <attribute>
0047            <name>item_attribute_name</name>
0048            <value>some item name2</value>
0049          </attribute>
0050        </attributes>
0051      </item>
0052    </items>
0053  </eshop>

When No Items Are for Sale

If no items are for sale because, for example, the sale of all service items was ended prior to the end of service, length, offset, and total are all set to 0 in the response.

If this response is returned, the recommendation is to display a message such as "The item is not currently available."

Code 2-6. Example Response When No Items Are for Sale
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>b048e3ce-b56f-4aae-bc7d-0756b73b66a4</correlation_id>
0004    <items>
0005      <length>0</length>
0006      <offset>0</offset>
0007      <total>0</total>
0008    </items>
0009  </eshop>

2.2.1.2. Getting the Account Balance

Overview

Gets the balance held by the Nintendo Network account specified in the parameters.

Note:

Do not cache the balance on an independent server after getting it from the eShop API. The eCash balance varies depending on the user's actions, such as making purchases in the eShop or adding funds to the account.

Request

Table 2-7. Parameters
Parameter Optional Description
pid No Principal ID for the Nintendo Network account. Use the value obtained from the service token received from the client.
lang Yes Language configured in System Settings. Use the language code received from the client. Used to determine the currency notation format. Also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified Nintendo Network account.
Code 2-7. URL
GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/$pid/balance?lang=$lang
e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/balance?lang=en

Response

Node

  • balance: The account balance.
    • amount: The account balance formatted for the currency.
    • currency: The currency code defined by ISO 4217.
    • raw_value: The unformatted account balance.
Code 2-8. Sample Response From the API for Getting the Account Balance
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <balance>
0005      <amount>$10.00</amount>
0006      <currency>USD</currency>
0007      <raw_value>10</raw_value>
0008    </balance>
0009  </eshop>

2.2.1.3. Getting Pre-Purchase Information

Overview

You can get information about the item specified by the item code before purchase. The kind of information available before purchase includes the item's retail price, the current balance, and the balance after purchase.

The retail price is the item's price as of the receipt of the request.

The tax amount appears if the Nintendo Network account's country setting is for a tax-exclusive country. The tax amount is calculated based on the region of the specified Nintendo Network account.

Note:

If the post-purchase balance is negative, the purchase process always fails. Do not call the API that requests a purchase.

Note:

It is not possible to add to a balance using the eShop REST API. Funds must be added from the eShop application.

Note:

On 3DS, you can send a request to the EC applet for the addition of the balance shortfall.

You can use this API to determine whether there are sufficient funds by checking if the post-purchase balance is negative.

If there are insufficient funds, the post-purchase balance string without the negative sign (-) is the amount of the shortfall. When adding funds via the EC applet, only add the amount that the balance was short.

Request

Table 2-8. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
item_code No Item code.
pid No Principal ID for the Nintendo Network account. Use the value obtained from the service token received from the client.
lang Yes Language configured in System Settings. Use the language code received from the client. Used to determine the currency notation format. Also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified Nintendo Network account.
Code 2-9. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/$title_code/items/$item_code/prepurchase_info?lang=$lang&pid=$pid
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/titles/1D000100/items/item100001/prepurchase_info?lang=en&pid=pid100001

Response

Node

  • prepurchase_info: Root node of the pre-purchase information.
    • purchasing_item: The item to purchase.
      • item_code: Item code.
      • payment_amount: The amount to be paid for the item.
        • price: The retail price of the item.
          • regular_price: The suggested retail price of the item.
            • id: Retail price ID. Used as the price to pay when purchasing the item (price_id).
            • amount: The retail price formatted for the currency (for example, $10.00).
            • currency: The currency code defined by ISO 4217 (for example, USD).
            • raw_value: The unformatted retail price (for example, 10).
        • tax_amount: The tax amount.
          • amount: The tax amount formatted for the currency (for example, $1.50).
          • currency: The currency code defined by ISO 4217 (for example, USD).
          • raw_value: The unformatted tax amount (for example, 1.5).
        • total_amount: The total amount.
          • amount: The total amount formatted for the currency (for example, $11.50).
          • currency: The currency code defined by ISO 4217 (for example, USD).
          • raw_value: The unformatted total amount (for example, 11.5).
    • current_balance: The current balance.
      • amount: The current balance formatted for the currency (for example, $20.00).
      • currency: The currency code defined by ISO 4217 (for example, USD).
      • raw_value: The unformatted current balance (for example, 20).
    • post_balance: The remaining account balance after purchase.
      • amount: The post-purchase account balance formatted for the currency (for example, $20.00).
      • currency: The currency code defined by ISO 4217 (for example, USD).
      • raw_value: The unformatted post-purchase balance (for example, 20).
Code 2-10. Sample Response From the API for Getting Pre-Purchase Information
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <prepurchase_info>
0005      <purchasing_item>
0006        <item_code>item0001</item_code>
0007        <payment_amount>
0008          <price>
0009            <regular_price>
0010              <id>123</id>
0011              <amount>$10.00</amount>
0012              <currency>USD</currency>
0013              <raw_value>10</raw_value>
0014            </regular_price>
0015          </price>
0016          <tax_amount>
0017            <amount>$1.00</amount>
0018            <currency>USD</currency>
0019            <raw_value>1</raw_value>
0020          </tax_amount>
0021          <total_amount>
0022            <amount>$11.00</amount>
0023            <currency>USD</currency>
0024            <raw_value>11</raw_value>
0025          </total_amount>
0026        </payment_amount>
0027      </purchasing_item>
0028      <current_balance>
0029        <amount>$20.00</amount>
0030        <currency>USD</currency>
0031        <raw_value>20</raw_value>
0032      </current_balance>
0033      <post_balance>
0034        <amount>$9.00</amount>
0035        <currency>USD</currency>
0036        <raw_value>9</raw_value>
0037      </post_balance>
0038    </prepurchase_info>
0039  </eshop>

2.2.1.4. Purchasing Items

Overview

Purchases the specified item. If the purchase is successful, a license for the relevant item is granted to the specified Nintendo Network account.

In the process of making a purchase, the application sends the independent server a purchase request, which the independent server then sends to the eShop Server. The eShop Server then responds with the results of the purchasing process, which the application should display as appropriate.

When communicating with an independent server, the independent server's service token and EC service token are required. The application must get an EC service token from the account server, and then send that token as is to the eShop Server. One EC service token must be obtained for each purchase request.

Get an EC service token using the dedicated account library API. EC service tokens are only valid for one minute after being issued. Do not cache them in the independent server. A new one from the account server must be obtained for every purchase.

Note:

It is not possible to add to a balance using the eShop REST API. Funds must be added from the eShop application or the EC applet.

Figure 2-3. Service Item Purchasing Process

Request

Table 2-9. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
item_code No Item code.
pid No Principal ID for the Nintendo Network account. Use the value obtained from the service token received from the client.
price_id No Price information ID.
reference_id No Reference ID (32 hexadecimal characters. Lowercase alphanumeric [a-f0-9]{32}.)
balance No Balance of the account obtained from the balance retrieval function.
item_name No Item name of the purchased service item (for display in the purchase history).
ec_service_token No eShop service token obtained from account server (Base64 format).
ext_transaction_id No The unique ID of the transaction issued by the independent server. Specify a unique string up to 32 bytes long. To avoid collisions with other titles, use the title code for the first 8 digits.
Note that the eShop REST API does not check transaction IDs for uniqueness. Use this transaction ID to query Nintendo about the status of the transaction.
lang Yes Language configured in System Settings. Use the language code received from the client. Used to determine the currency notation format. Also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified Nintendo Network account.
signature No A digital signature calculated from the normalized parameters. (Hexadecimal.)
Code 2-11. URL
0001  POST https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/ $title_code /items/ $item_code /purchase
0002  e.g.) POST https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/titles/0D000100/items/item100001/purchase
0003  lang=en&pid=pid100001&price_id=12345&reference_id=123456789012345678901234567890AB&balance=10.5&item_name=SomeItemName&ext_transaction_id=0D000100SomeTransactionId&ec_service_token=Xe9bEgaeQbD==&signature=1defe519056a680b125e493ce8267a5feebcfc4f09bdfc85f7661e7509bc12d3

Calculating the Digital Signature

To ensure the security of the purchase request, add the digital signature to the parameters. Generate the digital signature using the following procedure, and add it to the request as the "signature" parameter.

  • Request the parameter format.
    1. URL-encode the parameter name and value for each required parameter, and link them with an equal sign (=). (Optional parameters do not affect the signature.))
    2. Sort the string created in step 1 in alphabetical order, by parameter name.
    3. Link the string sorted in step 2 by & (ampersand).
Code 2-12. Example of Parameters Used for the Signature and After Formatting
Parameters Used for the Signature
pid=pid100001 
price_id=12345
reference_id=123456789012345678901234567890AB
balance=10.5
item_name=SomeItemName 
ext_transaction_id=0D000100SomeTransactionId 
ec_service_token=Xe9bEgaeQbD==

Parameters After Formatting
balance=10.5&ec_service_token=Xe9bEgaeQbD%3D%3D&ext_transaction_id=0D000100SomeTransactionId&item_name=SomeItemName&pid=pid100001&price_id=12345&reference_id=123456789012345678901234567890AB
Note:

The title_code and item_code request parameters are not used for the signature.

  • Creating the signature string:
    1. The signature string is the HTTP request method name, the URL-encoded FQDN, and the URL encoded string created by the request parameter format, linked by ampersands (&).
Note:

The digital signature sent to the eShop server is compared with the signature string which was encoded on the eShop server-side using the encode member function from java.net.URLEncoder. Use an encoding method for the digital signature that you send that complies with that of the encode member function from java.net.URLEncoder.

Use UTF-8 as the encoding method for any characters other than the following:  , a-z, A-Z, 0-9, ".", "-", "*", "_", " ".

 

Code 2-13. Example of Linked Strings and Strings Used in the Signature
Linked Strings
POST 
https://akindo.ctr.shop.nintendo.net 
balance=10.5&ec_service_token=Xe9bEgaeQbD%3D%3D&ext_transaction_id=0D000100SomeTransactionId&item_name=SomeItemName&pid=pid100001&price_id=12345&reference_id=123456789012345678901234567890AB

Strings Used in the Signature
POST&https%3A%2F%2Fakindo.ctr.shop.nintendo.net&balance%3D10.5%26ec_service_token%3DXe9bEgaeQbD%253D%253D%26ext_transaction_id%3D0D000100SomeTransactionId%26item_name%3DSomeItemName%26pid%3Dpid100001%26price_id%3D12345%26reference_id%3D123456789012345678901234567890AB
Note:

The FQDN used for the signature is fixed regardless of the server environment being used.

On 3DS, https://akindo.ctr.shop.nintendo.net is used, while on Wii U, https://akindo.wup.shop.nintendo.net is used.

  • Generating a digital signature:
    1. Using the TIN as the secret key, calculate the digital signature from the signature string generated in Generating Signature Strings using HMAC-SHA256.
Code 2-14. Digital Signature and Final Parameters
Digital signature when TIN is 1111111111
1defe519056a680b125e493ce8267a5feebcfc4f09bdfc85f7661e7509bc12d3

■ Final purchase API parameter
lang=en 
pid=pid100001 
price_id=12345 
reference_id=123456789012345678901234567890AB 
balance=10.5 
item_name=SomeItemName 
ext_transaction_id=0D000100SomeTransactionId 
ec_service_token=Xe9bEgaeQbD== 
signature=1defe519056a680b125e493ce8267a5feebcfc4f09bdfc85f7661e7509bc12d3
Note:

Configure the Content-Type header value for the request as follows.

application/x-www-form-urlencoded; charset=UTF-8

When a multibyte character set such as Japanese is used for the item name string, the resulting URL encoded string may not be correctly decoded by the eShop server.

Response

Node

  • transaction_result: Root node for the transaction information.
    • transaction_id: Transaction ID issued by Nintendo.
    • ext_transaction_id: Transaction ID specified by the independent server.
    • item_code: The item code of the purchased item.
    • reference_id: The reference ID of the purchased item.
    • post_balance: Balance information after the transaction is executed.
      • amount: The account balance formatted for the currency (for example, $10.00).
      • currency: The currency code defined by ISO 4217 (for example, USD).
      • raw_value: The unformatted account balance (for example, 10.0).
Code 2-15. Sample Response From the API for Purchasing Items
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <transaction_result>
0005      <transaction_id>asdfasdfasdfasdf</transaction_id>
0006      <ext_transaction_id>SomeExtTransactionId</ext_transaction_id> 
0007      <item_code>item101</item_code> 
0008      <reference_id>123456789012345678901234567890AB</reference_id> 
0009      <post_balance>
0010        <amount>$0.50</amount>
0011        <currency>USD</currency>
0012        <raw_value>0.5</raw_value>
0013      </post_balance>
0014    </transaction_result>
0015  </eshop>

2.2.1.5. Getting License Information

Overview

Gets the license information for the specified service title.

This can be used to retrieve the license information for all of the Nintendo Network accounts linked to devices that are tied to the specified Nintendo Network account. Even if the specified Nintendo Network account does not have a license, if another Nintendo Network account does have a license, the system returns the license information for that network account.

In accordance with the ticket type, process the obtained ticket information as follows.

Permanent ticket

For permanent tickets, provide the service as soon as the ticket information from the eShop Server is received.

Subscription ticket

For subscription tickets, the independent server must first check that the ticket information is currently valid and has not expired.

Ticket information obtained from the eShop server contains the valid period as a UNIX® system timestamp value. Compare the valid period time against the current time, and provide the service if the ticket is currently valid. For the current time, use the independent server's time synchronized against an NTP, or the eShop server time returned together with the ticket information.

Consumable service ticket

For consumable service tickets, the information you can get from the eShop server only includes the total number of ticket usages that have been purchased. Note that this value is not the number of times remaining that the ticket can be used.

Store the number of times the ticket has already been used on the independent server, and then use that number to calculate the number of times remaining that the ticket can be used. Subtract the total number of times the ticket has already been used, as stored on the independent server, from the total number of ticket usages purchased, as stored on the eShop server, and only provide the service for the remaining number of times the ticket can be used.

An example where this would be relevant would be a power-up item sold for use in an online action game. Assuming the user purchases three power-up items, the ticket information obtained from the eShop server would record three total ticket usages purchased. After the user has used one of the three power-up items, record on the independent server that the ticket has been used one time. The difference between the three total ticket usages and the one time the ticket has been used would leave two remaining times that the ticket can be used, and the application would inform the user of this fact.

Figure 2-4. Service Item License Certification Process

 

Request

Table 2-10. Parameters
Parameter Optional Description
pid No Principal ID for the Nintendo Network account. Use the value obtained from the service token received from the client.
title_code No Title code identifying the game title (8-digit hexadecimal).
reference_id Yes Reference ID (32 hexadecimal characters. Lowercase alphanumeric [a-f0-9]{32}.). If a reference ID is specified, returns only the license information for the relevant reference ID. If not specified, returns the license information for all of the reference IDs for the title.
Code 2-16. URL
GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/$pid/rights/titles/$title_code/items/$reference_id
e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/rights/titles/1D000100/items/123456789012345678901234567890AB

Response

Node With the Reference ID Specified

  • item_rights: List of rights.
    • reference_id: Reference ID to identify the item purchased.
    • item_right: The Nintendo Network account that has the license for the item belonging to the specified title.
      • pid: Principal ID for the Nintendo Network account.
      • right_type: License type (permanent, subscription, or consumable).
      • right_value: License according to the license type (for permanent licenses, not used; for subscription licenses, the expiration date; for consumable licenses, the number of uses purchased).
Code 2-17. Sample Response When the Reference ID Is Specified in the API for Getting License Information
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <item_rights>
0005      <reference_id>123456789012345678901234567890AB</reference_id>
0006      <item_right>
0007        <pid>pid100001</pid>
0008        <right_type>ADDITIONAL TIME</right_type>
0009        <right_value>1110000000</right_value>
0010      </item_right>
0011      <item_right>
0012        <pid>pid100002</pid>
0013        <right_type>ADDITIONAL TIME</right_type>
0014        <right_value>1220000000</right_value>
0015      </item_right>
0016    </item_rights>
0017  </eshop>

Node Without the Reference ID Specified

  • rights: Root node of the license information.
    • item_rights: List of rights.
      • reference_id: Reference ID to identify the item purchased.
      • item_right: The Nintendo Network account that has the license for the item belonging to the specified title.
        • pid: Principal ID for the Nintendo Network account.
        • right_type: License type (permanent, subscription, or consumable).
        • right_value: License according to the license type (for permanent licenses, not used; for subscription licenses, the expiration date; for consumable licenses, the number of uses purchased).
Code 2-18. Sample Response When the Reference ID Is Not Specified in the API for Getting License Information
<eshop>
  <version>1.0</version>
    <correlation_id>cor112358132134</correlation_id>
    <rights>
      <item_rights>
      <reference_id>123456789012345678901234567890AB</reference_id>
      <item_right>
        <pid>pid100001</pid>
        <right_type>ADDITIONAL TIME</right_type>
        <right_value>1110000000</right_value>
      </item_right>
      <item_right>
        <pid>pid100002</pid>
        <right_type>ADDITIONAL TIME</right_type>
        <right_value>1220000000</right_value>
      </item_right>
    </item_rights>
    <item_rights>
      <reference_id>12345678901234567890123456789CD</reference_id>
      <item_right>
        <pid>pid100001</pid>
        <right_type>ADDITIONAL TIME</right_type>
        <right_value>1110000000</right_value>
      </item_right>
      <item_right>
        <pid>pid100002</pid>
        <right_type>ADDITIONAL TIME</right_type>
        <right_value>1110000000</right_value>
      </item_right>
    </item_rights>
  </rights>
</eshop>

2.2.1.6. Getting the Purchase History

Overview

Gets the purchase history for the specified Nintendo Network account.

Gets the purchase history for each title code. Also, unlike with the license information retrieval API, you can only get the purchase history for the specified Nintendo Network account.

Request

Table 2-11. Parameters
Parameter Optional Description
pid No ID to identify the Nintendo Network account.
title_code No Title code identifying the game title (8-digit hexadecimal).
lang Yes Language configured in System Settings. Use the language code received from the client. Used to determine the currency notation format. Also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified Nintendo Network account.
offset Yes The offset for all purchase history transactions.
limit Yes Number of purchase histories to get. When omitted, 50 is set as the default.)
Code 2-19. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/$pid/transactions/titles/$title_code?lang=$lang&offset=$offset&limit=$limit
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/transactions/titles/1D000100?lang=en&offset=0&limit=20

Response

Node

  • transactions: Root node of the purchase history information.
    • total: Total number of items in the purchase history.
    • length: Number of purchase-history items in this response.
    • offset: Offset.
    • transactions: Purchase-history information.
      • transaction_id: Transaction ID.
      • ext_transaction_id: Transaction ID specified by the independent server.
      • date: Transaction date and time.
      • type: Transaction type (PURCHASE / REDEEM / DELETE).
      • description: Transaction details.
      • transaction_amount: Total amount paid, including tax.
        • amount: The total amount paid, formatted for the currency (for example, $10.00).
        • currency: The currency code defined by ISO 4217 (for example, USD).
        • raw_value: The unformatted total amount paid (for example, 10.0).
      • item: Item information.
        • item_code: Item code.
        • reference_id: Reference ID.
        • limit: License information for this service item.
          • type: License type for this service item.
          • value: Value corresponding to the license for this item (limited period of time, limited number of times). If the license type is unlimited, this value does not exist.
Code 2-20. Sample Response From the API for Getting the Purchase History
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <transactions>
0005      <total>30</total>
0006      <length>2</length>
0007      <offset>0</offset>
0008      <transaction>
0009        <transaction_id>1001</transaction_id>
0010  	  <ext_transaction_id>0D000100-abcdefghijklmnopqrstuvwxyz01</ext_transaction_id> 
0011        <date>2012-06-05T11:00:00Z</date>
0012        <type>PURCHASE</type>
0013        <description>some message</description>
0014        <transaction_amount>
0015          <amount>$0.50</amount>
0016          <currency>USD</currency>
0017          <raw_value>0.5</raw_value>
0018        </transaction_amount>
0019        <item>
0020          <item_code>item1000001</item_code>
0021          <reference_id>123456789012345678901234567890AB</reference_id>
0022          <limit>
0023            <type>ADDITIONAL TIME</type>
0024            <value>3600</value>
0025          </limit>
0026        </item>
0027      </transaction>
0028      <transaction>
0029        <transaction_id>1002</transaction_id> 
0030        <ext_transaction_id>0D000100-abcdefghijklmnopqrstuvwxyz02</ext_transaction_id> 
0031        <date>2012-06-06T10:00:00Z</date>
0032        <type>PURCHASE</type>
0033        <description>some message</description>
0034        <transaction_amount>
0035          <amount>$0.50</amount>
0036          <currency>USD</currency>
0037          <raw_value>0.5</raw_value>
0038        </transaction_amount>
0039        <item>
0040          <item_code>item1000002</item_code>
0041          <reference_id>123456789012345678901234567890CD</reference_id>
0042          <limit>
0043            <type>ADDITIONAL TIME</type>
0044            <value>3600</value>
0045          </limit>
0046        </item>
0047      </transaction>
0048    </transactions>
0049  </eshop>
Note:

The response from the API for getting the purchase history is sorted in ascending order from the most recent purchase.

2.2.1.7. Getting the Payment Status

Overview

Get the payment status for a specified purchase from the purchase history of a particular network account.

Gets the payment status for each title code. Only the payment status for the specified network account can be obtained. This differs from the license information retrieval API.

Using the API

The API for getting payment status is for use when user item license information is managed independently by an independent server, and the Nintendo eShop server does not get and confirm the license information.

This type of implementation is restricted by the guidelines. However, when using the eShop mechanisms to provide a time-based service, the following constraints apply, so the guidelines may be ignored in some cases after advance consultation with Nintendo.

  • The period of validity could start at some arbitrary time after purchase.
  • If a period of time occurs when the user cannot use the service due to maintenance of an independent server or an other unforeseen issue, it is not possible to compensate the user (extend validity period) from just the independent server.

When license information is managed only on an independent server, inconsistencies can arise between license information at the eShop and on the independent server. This can happen in cases such as the following.

  • A timeout occurs internally on the eShop server during the purchase.
    • An error is returned as the response from the front-end eShop server to the independent server.
    • However, in some cases, the processing on the server performing the purchase itself completes and the amount is deducted from the user's account.

When this state occurs, if the mechanism adds to the user's license information based on a successful purchase response at the independent server, the license may not be granted even though the purchase was completed.

Use this API to resolve inconsistencies arising between the eShop server and independent servers in these cases.

Specifically, use it as follows.

  • If a purchase request fails due to an internal server error, check whether the purchase in the transaction completed.
  • Periodically batch-process transactions that had errors and correct any inconsistencies.
Note:

This API creates load on the eShop server. Only use it in fault conditions (when a purchase fails). It must not be called for normal cases, such as when purchase completed successfully.

Note:

To use this API in any other case, first contact Nintendo.

Restriction on the Number of API Calls

A limit on the number of calls to the payment status API has been set.

Currently a limit of 1800 calls every 900 seconds is permitted, and an error is returned if this limit is exceeded.

Code 2-21. Sample Response When the API Call Limit Is Exceeded
HTTP Status Code: 429 Too Many Requests
<eshop>
  <version>1.0</version>
  <correlation_id>cor112358132137</correlation_id>
  <error>
    <code>109-3696</code>
  </error>
</eshop>
Note:

If you use this API, make sure that you implement appropriate error handling for cases when this limitation on the number of calls is exceeded.

Request

Table 2-12. Parameters
Parameter Optional Description
pid No ID to identify the Nintendo Network account.
title_code No Title code identifying the game title (8-digit hexadecimal).
ext_transaction_id No Transaction ID specified by the independent server at the time of purchase.
Code 2-22. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/$pid/transactions/titles/$title_code?ext_transaction_id=$ext_transaction_id 
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/transactions/titles/1D000100?ext_transaction_id=1D000100-abcdefghijklmnopqrstuvwxyz01

Response

When the Applicable Purchase History Exists

  • transaction: Root node of the payment status.
    • transaction_id: Transaction ID.
    • ext_transaction_id: Transaction ID specified by the independent server.
    • date: Transaction date and time.
    • type: Transaction type (PURCHASE / REDEEM / DELETE).
    • description: Transaction details.
    • transaction_amount: Total amount paid, including tax.
      • amount: The total amount paid, formatted in currency notation. For example, $10.00.
      • currency: The currency code defined by ISO 4217. For example, USD.
      • raw_value: The unformatted total amount paid. For example, 10.0.
    • item: Item information. (Returns null if the purchased item has been removed from the catalog.)
      • item_code: Item code.
      • reference_id: Reference ID.
      • limit: License information for this service item.
        • type: License type for this service item.
        • value: Value corresponding to the license for this item (limited period of time, limited number of times). If the license type is unlimited, this value has no meaning.

When the Applicable Purchase History Does Not Exist

Code 2-23. Sample Response From the API for Getting Payment Status When the Purchase Does Not Exist
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132137</correlation_id>
0004  </eshop>

2.2.1.8. Getting Items Using Download Codes

Overview

Gets the subscription tickets, permanent tickets, or consumable items defined by the game title that has the specified title code, similar to when listing items.

This API, however, is limited to item codes that can be redeemed with the specified download code.

Request

Table 2-13. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
pid No Principal ID for the network account. Use the value obtained from the service token received from the client.
card_number No Download code (16 uppercase alphanumeric characters [A-Z0-9]{16}). Use the download code received from the client.
lang Yes Language configured in System Settings. Use the language code received from the client. This code is used to determine the display language for usage records and receipts. It is also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified network account.
Code 2-24. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/$title_code/redeem_items?card_number=$card_number&pid=$pid
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/titles/1D000100/redeem_items?card_number=ABCDEF1234567890&pid=100001

Response

Nodes

  • redeem_items : Root node for the service items list.
    • item: Service items.
      • item_code: The item code for this item.
      • initial_purchase_only: If true, the user cannot purchase the item if the user already has rights to that item's reference ID. You can tell whether the item for a reference ID can be purchased by getting the rights information when listing items.
      • limit: License information for this service item.
        • type: License type for this service item.
        • value: Value corresponding to the license for this item (limited period of time, limited number of times). If the license type is unlimited, this value has no meaning.
      • attributes: List of item attributes.
        • attribute: Item attribute.
          • name: Attribute name.
          • value: Attribute value.
Code 2-25. Sample Response From the API for Getting Items Using Download Codes
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132136</correlation_id>
0004    <redeem_items>
0005      <item>
0006        <item_code>item0001</item_code>
0007        <initial_purchase_only>true</initial_purchase_only>
0008        <limit>
0009          <type>CONSUMPTION</type>
0010          <value>100</value>
0011        </limit>
0012        <attributes>
0013          <attribute>
0014              <name>hoge</name>
0015              <value>hoge</value>
0016          </attribute>
0017        </attributes>
0018      </item>
0019      </redeem_items>
0020  </eshop>

2.2.1.9. Redeeming Items

Overview

Redeems the specified item. If the redemption is successful, a license for the relevant item is granted to the specified network account.

Request

Table 2-14. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
item_code No Item code.
pid No Principal ID for the network account. Use the value obtained from the service token received from the client.
card_number No Download code (16 uppercase alphanumeric characters [A-Z0-9]{16}). Use the download code received from the client.
reference_id No Reference ID (32 hexadecimal characters). Lowercase alphanumeric [a-f0-9]{32}.
item_name No Item name of the purchased service item (for display in the purchase history).
ec_service_token No EC service token obtained from NNAS (Base64 format).
ext_transaction_id No The unique ID of the transaction issued by the independent server. Specify a unique string up to 32 bytes long. To avoid collisions with other titles, use the title code for the first eight digits. Note that the eShop REST API does not check transaction IDs for uniqueness. Use this transaction ID to query Nintendo about the status of the transaction.
lang Yes System Language setting. Use the language code received from the client. This code is used to determine the display language for usage records and receipts. It is also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified network account.
signature No A digital signature calculated from the normalized parameters.
Code 2-26. URL
0001  POST https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/$title_code/items/$item_code/redeem
0002  e.g.) POST https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/titles/1D000100/items/item0001/redeem
0003  pid=pid100001&card_number=ABCDEF1234567890&reference_id=123456789012345678901234567890AB&item_name=SomeItemName&ext_transaction_id=1D000100SomeTransactionId&ec_service_token=Xe9bEgaeQbD==&signature=1ce48226339445a2f88620a5ba2b64e634632e10cf27e406fa048269be02d71c

Calculating the Digital Signature

The procedure for calculating the signature is the same as for the item purchase API. Note however that the parameters used for the signature are different.

Response

Nodes

  • transaction_result: Root node for the transaction information.
    • transaction_id: Transaction ID issued by Nintendo.
    • ext_transaction_id: Transaction ID specified by the independent server.
    • item_code: Item code of the redeemed item.
    • reference_id: Reference ID of the redeemed item.
Code 2-27. Sample Response From the Item Redemption API
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <transaction_result>
0005      <transaction_id>asdfasdfasdfasdf</transaction_id>
0006      <ext_transaction_id>SomeExtTransactionId</ext_transaction_id>
0007      <item_code>item101</item_code>
0008      <reference_id>123456789012345678901234567890AB</reference_id>
0009    </transaction_result>
0010  </eshop> 

2.2.1.10. Getting Messages for a Declaration Based on Law

Overview

Gets a flag that indicates whether a declaration based on law must be displayed for the specified title, and the message to display if it does.

If no message is registered for the specified title, this API gets the message from the country settings of the account with the specified PID.

Request

Table 2-15. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
pid No Principal ID for the network account. Use the value obtained from the service token received from the client.
lang Yes Language configured in System Settings. Use the language code received from the client. If omitted, the system uses the eShop language for the specified network account.
Code 2-28. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/$title_code/law_message?lang=$lang&pid=$pid
0002  e.g.) GET https://akindo-d1.wup.shop.nintendo.net/akindo/rs/titles/1D000100/law_message?lang=en&pid=pid100001

Response

Node

  • text: Root note of the message for the declaration based on law.
    • message_required: Flag indicating whether the message needs to be displayed. true/false
    • type: The text type. This is fixed as text in this API.
    • body: The text of the declaration based on law.

Note, however, that the type and body elements only exist when the message must be displayed.

Code 2-29. Sample Response From the API for Getting Messages for Declaration Based on Law (When the Message Must Be Displayed)
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132136</correlation_id>
0004    <text>
0005      <message_required>true</message_required>
0006      <type>text</type>
0007      <body>hogehogefugafuga</body>
0008    </text>
0009  </eshop>
Code 2-30. Sample Response From the API for Getting Messages for Declaration Based on Law (When the Message Is Not Displayed)
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132136</correlation_id>
0004    <text>
0005      <message_required>false</message_required>
0006    </text>
0007  </eshop>

2.2.2. API for Recurring Billing

Recurring billing items are special service items that process the next payment automatically before expiration is set to occur. Currently, this feature only works with time-based service items.

A balance cannot be used to purchase recurring billing items. Only credit card payments are accepted.

 

The purchase of recurring billing items on the Wii U can only occur via Nintendo eShop. Note that unlike normal service items, purchases cannot occur via the REST API.

 

Note:

Recurring billing is presently only available for application in Japan. Contact Nintendo if you would like to use recurring billing outside of Japan.

2.2.2.1. Getting a List of Recurring Billing Items

Overview

Gets a list of recurring billing items defined by the game title that has the specified title code.

Items must be registered beforehand as eShop backend server processing automatically occurs during each payment cycle. For this reason, the list of items displayed then is different from the usual service item list, and matching with the item list saved on the independent server is not required.

If the number of items is large, you can restrict the number of items obtained by specifying an offset value and the maximum number in the list.
The items obtained in the item list are only those items currently sold in the country that is set for the specified network account.
Items that are planned for sale, or for which sales have already ended, are not included in the list.

Request

Table 2-16. Parameters
Parameter Optional Description
title_code No Title code identifying the game title (8-digit hexadecimal).
pid No Principal ID for the network account. Use the value obtained from the service token received from the client.
lang Yes

Language configured in System Settings. Use the language code received from the client. Used to determine the currency display format.

It is also used to determine the display language for usage records and receipts. If omitted, the system uses the eShop language for the specified network account.

offset Yes Offset for getting service items from the search results that match the filter.
limit Yes Number of service items to get as search results.
Code 2-31. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/titles/ $title_code /auto_billing?lang= $lang & pid= $pid & offset= $offset & limit= $limit
0002  e.g.) GET https://akindo.wup.shop.nintendo.net/akindo/rs/titles/1D000100/auto_billing?lang=ja&pid=pid100001&offset=0&limit=10

Response

  • plans : Root node for the recurring billing item list.
    • total: Total number of recurring billing items matching the search.
    • length: Number of recurring billing items in this response.
    • offset: Offset.
    • description: Recurring billing description for this title (Wii U only).
    • plan : Recurring billing item.
      • item_code: The item code for this item.
      • reference_id: The reference ID for this item.
      • description: The description of this item.
      • disclaimer : The pre-purchase disclaimer for this item.
      • name: The item name for this item.
      • price: The price of this item.
        • regular_price: The retail price of this item. (Whether tax is included depends on the country.)
          • amount: The retail price formatted for the currency (for example, $10.00).
          • currency: The currency code defined by ISO 4217 (for example, USD).
          • raw_value: The unformatted retail price (for example, 10).
Code 2-32. Response From Getting the List of Recurring Billing Items
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <plans>
0005      <total>30</total>
0006      <length>2</length>
0007      <offset>0</offset>
0008      <description></description>
0009      <plan>
0010        <item_code>item100001</item_code>
0011        <reference_id>123456789012345678901234567890BA</reference_id>
0012        <description>Description Text</description>
0013        <disclaimer>Pre-Purchase Disclaimer</disclaimer>
0014       <name>Item Name</name>
0015      </plan>
0016      <plan>
0017        <item_code>item100002</item_code>
0018        <reference_id>012345678901234567890123456789AB</reference_id>
0019        <description>...</description>
0020        <disclaimer>...</disclaimer>
0021        <name>...</name>
0022      </plan>
0023    </plans>
0024  </eshop>

2.2.2.2. Getting License Information That Includes Recurring Billing Contract Information

Overview

Gets the license information for the specified service title.

This can be used to retrieve the license information for all of the network accounts linked to devices that are tied to the specified network account. Even if the specified network account does not have a license, if another network account does have a license, the system returns the license information for that network account.

If recurring billing is set in the title, it also returns whether the consecutive purchase of subscription tickets occurs automatically.

 

The value for auto_billing_applied, included with the response, is true when the purchase of a recurring billing item succeeds. This value is false when one of the following conditions is met.

  • The agreement was not updated before the rights went to zero (0).
    • If Nintendo eShop fails to automatically update the agreement for any reason, an email notification will be sent to the user.
    • The system will retry the update process until the rights are gone. The contract remains in force if the update succeeds before the rights go to zero (0).
    • If the contract update does not succeed before the rights go to zero (0), auto_billing_applied becomes false.
  • The API to clear recurring billing was successfully carried out.
    • The instant that API succeeds, auto_billing_applied becomes false.

Request

Table 2-17. Parameters
Parameter Optional Description
pid No ID to identify the Nintendo Network account. Get this ID by decoding the service token received from the client.
title_code No Title code identifying the game title (8-digit hexadecimal).
reference_id Yes Reference ID (32 hexadecimal characters). Lowercase alphanumeric [a-f0-9]{32}. If a reference ID is specified, returns only the license information for the relevant reference ID. If not specified, returns the license information for all of the reference IDs for the title.
Code 2-33. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/$pid/rights/titles/$title_code/items/$reference_id
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/rights/titles/1D000100/items/123456789012345678901234567890AB

Response

With the Reference ID Specified

(Reference ID: 123456789012345678901234567890AB is assumed to be set on IMAS.)

  • item_rights: List of rights.
    • reference_id: Reference ID to identify the item purchased.
    • item_right: The network account that has the license for the item belonging to the specified title.
      • pid: Principal ID of the network account.
      • right_type: License type (permanent, subscription, or consumable).
      • right_value: License according to the license type (for permanent licenses, not used; for subscription licenses, the expiration date; for consumable licenses, the number of uses purchased).
      • auto_billing_applied : Boolean value indicating whether recurring billing contract is enabled.
Code 2-34. Sample Response From the Getting License Information That Includes Recurring Billing Contract Information API (When Reference ID Is Specified)
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <item_rights>
0005      <reference_id>123456789012345678901234567890AB</reference_id>
0006      <item_right>
0007        <pid>pid100001</pid>
0008        <right_type>ADDITIONAL TIME</right_type>
0009        <right_value>1110000000</right_value>
0010        <auto_billing_applied>true</auto_billing_applied>
0011      </item_right>
0012      <item_right>
0013        <pid>pid100002</pid>
0014        <right_type>ADDITIONAL TIME</right_type>
0015        <right_value>1220000000</right_value>
0016        <auto_billing_applied>false</auto_billing_applied>
0017      </item_right>
0018    </item_rights>
0019  </eshop>

 

With the Reference ID Not Specified

(Reference ID: 123456789012345678901234567890AB is assumed to be set on IMAS.)

  • rights: Root node of the license information.
    • item_rights: List of rights.
      • reference_id: Reference ID to identify the item purchased.
      • item_right: The network account that has the license for the item belonging to the specified title.
        • pid: Principal ID of the network account.
        • right_type: License type (permanent, subscription, or consumable).
        • right_value: License according to the license type (for permanent licenses, not used; for subscription licenses, the expiration date; for consumable licenses, the number of uses purchased).
        • auto_billing_applied : Boolean value indicating whether recurring billing contract is enabled.

 

Code 2-35. Sample Response From the Getting License Information That Includes Recurring Billing Contract Information API (When Reference ID Is Unspecified)
0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <rights>
0005      <item_rights>
0006        <reference_id>123456789012345678901234567890AB</reference_id>
0007        <item_right>
0008          <pid>pid100001</pid>
0009          <right_type>ADDITIONAL TIME</right_type>
0010          <right_value>1110000000</right_value>
0011          <auto_billing_applied>true</auto_billing_applied>
0012        </item_right>
0013        <item_right>
0014          <pid>pid100002</pid>
0015          <right_type>ADDITIONAL TIME</right_type>
0016          <right_value>1220000000</right_value>
0017          <auto_billing_applied>false</auto_billing_applied>
0018        </item_right>
0019      </item_rights>
0020      <item_rights>
0021        <reference_id>123456789012345678901234567890BA</reference_id>
0022        <item_right>
0023          <pid>pid100001</pid>
0024          <right_type>ADDITIONAL TIME</right_type>
0025          <right_value>1110000000</right_value>
0026          <auto_billing_applied>true</auto_billing_applied>
0027        </item_right>
0028        <item_right>
0029          <pid>pid100002</pid>
0030          <right_type>ADDITIONAL TIME</right_type>
0031          <right_value>1110000000</right_value>
0032          <auto_billing_applied>true</auto_billing_applied>
0033        </item_right>
0034      </item_rights>
0035    </rights>
0036  </eshop>

2.2.2.3. Getting Recurring Billing Items Currently Under Contract

Overview

Gets recurring billing item information currently under contract for the specified service title. It does not get recurring billing item information currently under contract for all network accounts linked to the device, and only gets information for the specified network account.

Request

Table 2-18. Parameters
Parameter Optional Description
pid No Principal ID of the network account. Use the value obtained from the service token received from the client.
title_code No Title code identifying the game title (8-digit hexadecimal).
Code 2-36. URL
0001  GET https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/ $pid /rights/titles/ $title_code /auto_billing
0002  e.g.) GET https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/rights/titles/1D000100/auto_billing

Response

Gets recurring billing item information currently under contract for the specified service title. It does not get recurring billing item information currently under contract for all network accounts linked to the device, and only gets information for the specified network account.

  • contracts : Root node for the list of recurring billing items currently under contract.
    • contract : Contract information for recurring billing items.
      • item_code: The item code for this item.
      • reference_id: The reference ID of this item.
      • description: The description of this item.
      • name: The item name for this item.
      • next_purchase_date : Next scheduled payment date.
Code 2-37. Response From Obtaining Recurring Billing Items Currently Under Contract
0001   <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004    <contracts>
0005      <contract>
0006        <item_code>item100001</item_code>
0007        <reference_id>123456789012345678901234567890BA</reference_id>
0008        <description>Description Text</description>
0009       <name>Item Name</name>
0010        <next_purchase_date>2015-11-12</next_purchase_date>
0011      </contract>
0012    </contracts>
0013  </eshop>

2.2.2.4. Canceling Recurring Billing

Overview

Cancels recurring billing contract information for the specified item code. If it is successfully canceled, automatic payments will no longer be processed on the eShop back-end server.

Request

Table 2-19. Parameters
Parameter Optional Description
pid No Principal ID of the network account. Use the value obtained from the service token received from the client.
title_code No Title code identifying the game title (8-digit hexadecimal).
item_code No Item code.
ec_service_token No EC service token obtained from the account server (Base64 format).
Code 2-38. URL
0001  POST https://akindo(-server_env).platform_name.shop.nintendo.net/akindo/rs/accounts/ $pid /rights/titles/ $title_code /auto_billing/ $item_code /cancel
0002  e.g.) POST https://akindo-d1.ctr.shop.nintendo.net/akindo/rs/accounts/pid100001/rights/titles/1D000100/auto_billing/item0001/cancel?ec_service_token=Xe9bEgaeQbD==

Response

When Recurring Billing Is Canceled Successfully

0001  <eshop>
0002    <version>1.0</version>
0003    <correlation_id>cor112358132134</correlation_id>
0004  </eshop>
Note:

Get an EC service token using the dedicated account library API. EC service tokens are valid only for a limited time. They expire after one minute. Do not cache this token on the independent server. Get a new token from the account server each time a cancel occurs.

 


 


CONFIDENTIAL