Contents

Creating the source for an order

Define an order by creating the directory structure, and adding source files and images.

Overview

An order is a self-contained package that represents a purchase a user makes, and the current state of any fulfillments and tracking metadata. The source for your order includes all the information the system needs to show it to the user, such as:

  • Product images for line items and your merchant logo.

  • An order.json file that contains the strings the system displays to describe the order, and the current state of any fulfillments and tracking metadata.

  • Optional localization information.

Create the source in a directory that you use to create the final distributable order package. For information about building the order package and donating to Wallet, see Building a distributable order package.

Create the directory and add files and images

Create a directory to hold all the source files. Add the order.json file that contains the information and metadata for the order. For more information about the contents of this file, see the top-level Order object.

Create a visually rich order by providing product images of line items and a merchant logo to represent your company or brand. The system displays product images in notifications, including on the Lock Screen, when you publish relevant updates to the order.

Add localization

You can expand your audience by localizing the strings and images of your order for different languages and regions. Add a directory at the top-level source directory of each order for each localization. The name of the directory identifies the language and an optional region.

[language identifier]-[region identifier].lproj

For example, the name for the French localization directory is fr.lproj, and the name for the Simplified Chinese directory is zh-Hans.lproj. For more information about language identifiers, see Choosing localization regions and scripts.

Localize an image by adding the location-specific image files to each localization directory. For example, to add localized versions of a merchant logo, add the English version of logo@2x.png and logo@3x.png files to the en.lprojfolder, and the Simplified Chinese version of the logo@2x.png and logo@3x.png files to the zh-Hans.lproj folder. Reference your image in the order.json by the filename logo. Be sure to provide the same number of resolutions for each localization.

Localize the strings

The system localizes the strings in your order using a strings file that contains a list of keys and associated localized strings. For more information about fields that are localizable, see the top-level Order object.

Add localized strings to your order using the following steps:

  1. Set the value of a displayed string in order.json to a key, such as LineItemTitle for the title of a line item.

  2. Add an order.strings file to the localization folder.

  3. Add a line to each order.strings file that sets a key you create in order.json to the localized term.

For example, to localize a line item from English to German, set the value of the strings in the order.json to keys.

...  
"lineItems": [
    {
        "title": "LineItemTitle", 
        "subtitle": "LineItemSubtitle",
        "quantity": "2" 
    }
]
...

Define the values for the keys in the English strings in en.lproj/order.strings.

/* English Localization */
"LineItemTitle" = "Water Bowl";
"LineItemSubtitle" = "Green";

Then define the values for the keys in the German strings in de.lproj/order.strings.

/* German Localization */
"LineItemTitle" = "Wasserschale";
"LineItemSubtitle" = "Grün";

The system localizes fields that contain dates and times that use standard formats in the order.json file. The system always displays localized versions of these values, even when your order doesn’t contain localization folders for the language.

See Also

Essentials