Spend Request

Description

The Spend Service processes debit and undebit 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 Spend 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) - DEBIT
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 "D" or "debit" no
awardCode 6 String [0-9A-Za-z]+ no must be accessible to the user/ partner
miles 9 Integer [0-9]+ no must be > 0 and < 1,000,000
statementText1 20 String 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 no
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

Table 2. Input parameters Online REST (POST and PUT) - UNDEBIT>
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 "UD" or "undebit" no
transactionId 11 int [0-9]* no must reference a debit action
miles 9 Integer [0-9]+ no must be > 0 and < 1,000,000
statementText1 20 String 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 no
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 3. 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
spendRequest {
  pid (number, optional): partner ident number for intern use,
  cardNo (string): the Miles & More Card Number,
  action (string): the action to be processed (debit or undebit),
  awardCode (string): the award code for the partner,
  transactionId (number, optional): the referenced debit transaction (required for undebit),
  miles (number): the amount of miles,
  statementText1 (string, optional): the text to appear on the account statement,
  awardPackageId (string, optional): the award number (undebit only),
  additionalPartnerData (string, optional): additional data fields in JSON format
}

Request payload Example

Code snippet: Json
{
  "pid": 0,
  "cardNo": "string",
  "action": "string",
  "awardCode": "string",
  "transactionId": 0,
  "miles": 0,
  "statementText1": "string",
  "awardPackageId": "string",
  "additionalPartnerData": "string"
}

Request examples

Code snippet: Post request
POST https://api-test.lufthansa.com/v1/profiles/customers/spendrequest
Payload:
{
  "pid": 0,
  "cardNo": "992003020632539",
  "action": "debit",
  "awardCode": "ATES01",
  "transactionId": 0,
  "miles": 15222,
  "statementText1": "fdtestStmt1Zeichen20",
  "statementText2": "Statement2",
  "partnerData": "test partner data",
  "awardPackageId": "",
  "issueName": ""
 }
Code snippet: Put request
Put https://api-test.lufthansa.com/v1/profiles/customers/spendrequest/92253752?enforce="ok"
Payload:
{
  "pid": 0,
  "cardNo": "992003020632539",
  "action": "debit",
  "awardCode": "ATES01",
  "transactionId": 0,
  "miles": 15222,
  "statementText1": "fdtestStmt1Zeichen20",
  "statementText2": "Statement2",
  "partnerData": "test partner data",
  "awardPackageId": "",
  "issueName": ""
 }

Output parameters

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

Table 4. Output parameters 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
awardPackageId 15 Integer

Where MaxL = Maximal Length

Table 5. REST 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 6. 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 7. 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 8. articles
Name Type Max Length Allowed values Remarks
productId text 20
itemNetPrice number 9
vatRate number 2
awardCode text 6
campaignId text 9
miles number 9
useStartDate date dd.mm.yyyy
useStartLocation location see below
useEndDate date dd.mm.yyyy
useEndLocation location see below
milesLockDate date dd.mm.yyyy
partnerData text 100
Table 9. 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
spendResponse {
  status (string, 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,
  awardPackageId (number, optional): internal award number from Samba
}

Response Example

Code snippet: Json
{
  "transactionId": 92253752,
  "status": 4,
  "cardNo": "992003020632539",
  "action": "debit",
  "pid": 0,
  "bookedMiles": -15222,
  "remainingMiles": 2023558,
  "awardPackageId": 999999900474885,
  "statementText1": "fdtestStmt1Zeichen20",
  "statementText2": "Statement2"
}