Earn Request

Description

The Earn Service processes credit and uncredit requests. In addition to the marked fields additional required fields may be configured per customer, This section describes the different interface formats that are supported by the Earn Service. Most input parameters are shared among the interfaces, but some of them allow for sending additional data fields. For the output, the returned values vary depending on the input format.

Note: PUT is currently disabled!

Input parameters

For the REST interface, the input is provided in JSON format.

Table 1. Input parameters Online REST (POST and PUT)
Name MaxL Java-Type Allowed values Conf. Remarks
pid 9 BigInteger [0-9]* no if not set, a default value of 0 is applied
cardNo 20 String valid M&M card number no Miles & More Number (9 to 15 digit M&M number(both values including)).
action 2 String "C" or "UC" no "credit" and "uncredit" also accepted
property 6 String [0-9A-Za-z]+ no Promotion Code. Live Property Codes will be provided by MMI. Must be accessible to the user/ partner.
miles 9 Integer [0-9]+ no must be > 0 and < 1,000,000
activityDate 10 Date DD.MM.YYYY no must not be more than 14 months in the past or more than 2 days in the future
transactionText 20 String samba whitelist and | no value is required, appears on customer’s Miles & More account statement.
additionalPartnerData - String no hierarchy of sub elements in JSON format, see below (note: numeric values must be given as quoted strings)

Where MaxL = Maximal Length and Conf. = Confidential

The REST PUT interface has additional input parameters: a mandatory path parameter and an optional header parameter.

Table 2. Additional input parameters Online REST (PUT)
Name MaxL Java-Type Allowed values Conf. Remarks
transactionId 9 int [0-9]* no path parameter, mandatory. The ID of the transaction to reprocess
enforce 9 String "ok", "error", or "sendAgain" no optional query parameter, defaults to "sendAgain". Allows to execute the PUT request for transactions with status 2 (Pending), 6 (Dubious), 7 (Error), and 8 (For Verification)

Request payload Model

Code snippet: Model
earnRequest {
  pid (number, optional): partner ident number for intern use,
  cardNo (string): the Miles & More Card Number,
  action (string): the action to be processed (credit or uncredit),
  property (string): the property code for the partner,
  miles (number): the amout of miles,
  activityDate (string): purchase or invoice date,
  transactionText (string): the text to appear on the account statement,
  additionalPartnerData (string, optional): additional data fields in JSON format
}

Request payload Example

Code snippet: Json
{
  "pid": 0,
  "cardNo": "string",
  "action": "string",
  "property": "string",
  "miles": 0,
  "activityDate": "string",
  "transactionText": "string",
  "additionalPartnerData": "string"
}

Request examples

Code snippet: POST request
POST https://api-test.lufthansa.com/v1/profiles/customers/earnrequest

Payload:
 {
  "pid": 0,
  "cardNo": "992003020632653",
  "action": "credit",
  "property": "MT001",
  "miles": 5,
  "activityDate": "04.07.2016",
  "transactionText": "string",
  "lastName": "",
  "voucherNumber": "",
  "city": "",
  "location": "",
  "duration": "",
  "category4": "",
  "category5": "",
  "partnerData": ""
}
Code snippet: PUT request
PUT https://api-test.lufthansa.com/v1/profiles/customers/earnrequest/92253751?enforce="ok"
Payload:
 {
  "pid": 0,
  "cardNo": "992003020632653",
  "action": "credit",
  "property": "MT001",
  "miles": 5,
  "activityDate": "04.07.2016",
  "transactionText": "string",
  "lastName": "",
  "voucherNumber": "",
  "city": "",
  "location": "",
  "duration": "",
  "category4": "",
  "category5": "",
  "partnerData": ""
}

Output parameters

For REST responses, the returned fields depend on whether the request is successful or not.

Table 3. Output parameters Online REST (POST and PUT)
Name MaxL Java-Type Allowed values Remarks
status 1 Integer
  • 2: Pending
  • 4: OK
  • 5: Refused
  • 6: Dubious
  • 7: Error
  • 8: For Verification
transactionId 9 Integer the customer number
bookedMiles 9 Integer newest M&M card number
remainingMiles 10 Integer "HON", "SEN", "FTL", "BASE", "INST" or blank

Where MaxL = Maximal Length

Table 4. JSON output in case of failure
Name MaxL Type Allowed values Remarks
code 10 int Error code in case of error.
message 255 String Error message in case of error.

Where MaxL = Maximal Length

Additional Partner Data

The additional partner data consists of a hierarchy of different sub elements as given below. All fields are optional.

Table 5. additionalPartnerData
Name Type Max Length Allowed values Remarks
type text Standard | Promotion | Goodwill | Retro | Conversion
channel text Phone | PoS | App | Web | Web-Affiliate
deviceType text mobile | stationary
branchId number 9
purchaseDetails purchaseDetails see below
Table 6. purchaseDetails
Name Type Max Length Allowed values Remarks
receiptOrderNo text 30
terminalId text 20
campaignId text 9
payment number 9
currency text currency list to be provided
paymentType text Cash | EC | CC | direct debit | transfer | Online
articles list see below, multiple entries allowed
Table 7. articles
Name Type Max Length Allowed values Remarks
productId text 20
itemNetPrice number 9
vatRate number 2
propertyCode text 6
campaignId text 9
miles number 9
useStartDate date dd.mm.yyyy
useStartLocation location see below
useEndDate date dd.mm.yyyy
milesLockDate date dd.mm.yyyy
partnerData text 100
Table 8. location
Name Type Max Length Allowed values Remarks
street text 30
streetNumber number 5
addition text 10
postCode text 10
city text 30
region text 10
country text country codes, please contact us: https://developer.lufthansa.com/contact regarding the list

Response Model

Code snippet: Model
earnResponse {
status (number, optional): the processing status,
transactionId (number, optional): the ID of the created transaction,
bookedMiles (number, optional): the number of booked miles,
remainingMiles (number, optional): the number of remaining miles for the customer
}

Response Example

Code snippet: Json
{
  "status": 0,
  "transactionId": 0,
  "bookedMiles": 0,
  "remainingMiles": 0
}