使用amadeus航班创建订单API生成PNR问题



我想使用amadeus航班预订API创建预订并生成PNR。我遵循3个步骤来创建预订和生成PNR

  1. 航班提供搜索API使用以下API
https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-search/api-reference

  1. 航班优惠价格API使用以下API
https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-price/api-reference

  1. Flight Create Orders API using bellow API
https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders/api-reference

当我用单向方式搜索城市时,选择特定的报价并放置乘客详细信息创建预订和生成PNR。那么PNR就会成功生成我使用下面的API生成PNR

  https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders/api-reference

这是我的请求json

  "data": {
    "type": "flight-order",
    "flightOffers": [
      {
        "type": "flight-offer",
        "id": "5",
        "source": "GDS",
        "instantTicketingRequired": false,
        "nonHomogeneous": false,
        "paymentCardRequired": false,
        "lastTicketingDate": "2021-07-23",
        "itineraries": [
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "JFK",
                  "terminal": "5",
                  "at": "2021-07-30T09:20:00"
                },
                "arrival": {
                  "iataCode": "FLL",
                  "terminal": "3",
                  "at": "2021-07-30T12:30:00"
                },
                "carrierCode": "B6",
                "number": "201",
                "aircraft": {
                  "code": "320"
                },
                "operating": {
                  "carrierCode": "B6"
                },
                "duration": "PT3H10M",
                "id": "91",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 155,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              },
              {
                "departure": {
                  "iataCode": "FLL",
                  "terminal": "3",
                  "at": "2021-07-30T16:25:00"
                },
                "arrival": {
                  "iataCode": "LAX",
                  "terminal": "5",
                  "at": "2021-07-30T18:49:00"
                },
                "carrierCode": "B6",
                "number": "1301",
                "aircraft": {
                  "code": "32S"
                },
                "operating": {
                  "carrierCode": "B6"
                },
                "duration": "PT5H24M",
                "id": "92",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 253,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT12H29M"
          }
        ],
        "price": {
          "currency": "USD",
          "total": "276.20",
          "base": "235.35",
          "fees": [
            {
              "amount": "0.00",
              "type": "SUPPLIER"
            },
            {
              "amount": "0.00",
              "type": "TICKETING"
            },
            {
              "amount": "0.00",
              "type": "FORM_OF_PAYMENT"
            }
          ],
          "grandTotal": "276.20",
          "billingCurrency": "USD"
        },
        "pricingOptions": {
          "fareType": [
            "PUBLISHED"
          ],
          "includedCheckedBagsOnly": false
        },
        "validatingAirlineCodes": [
          "B6"
        ],
        "travelerPricings": [
          {
            "travelerId": "1",
            "fareOption": "STANDARD",
            "travelerType": "ADULT",
            "price": {
              "currency": "USD",
              "total": "276.20",
              "base": "235.35",
              "taxes": [
                {
                  "amount": "8.60",
                  "code": "ZP"
                },
                {
                  "amount": "5.60",
                  "code": "AY"
                },
                {
                  "amount": "17.65",
                  "code": "US"
                },
                {
                  "amount": "9.00",
                  "code": "XF"
                }
              ],
              "refundableTaxes": "40.85"
            },
            "fareDetailsBySegment": [
              {
                "segmentId": "91",
                "cabin": "ECONOMY",
                "fareBasis": "OL7AUEL1",
                "brandedFare": "DN",
                "class": "L",
                "includedCheckedBags": {
                  "quantity": 0
                }
              },
              {
                "segmentId": "92",
                "cabin": "ECONOMY",
                "fareBasis": "ZI3PUEL1",
                "brandedFare": "DN",
                "class": "L",
                "includedCheckedBags": {
                  "quantity": 0
                }
              }
            ]
          }
        ]
      }
    ],
    "travelers": [
      {
        "id": 1,
        "dateOfBirth": "**********",
        "name": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "gender": "**********"
      }
    ],
    "contacts": [
      {
        "addresseeName": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "purpose": "STANDARD",
        "emailAddress": "**********",
        "phones": [
          {
            "deviceType": "MOBILE",
            "countryCallingCode": "**",
            "number": "**********"
          }
        ],
        "address": {
          "lines": [
            "**********"
          ],
          "postalCode": "**********",
          "cityName": "**********",
          "countryCode": "**********"
        }
      }
    ],
    "remarks": {
      "general": [
        {
          "subType": "GENERAL_MISCELLANEOUS",
          "text": "ONLINE BOOKING FROM INCREIBLE VIAJES"
        }
      ]
    },
    "ticketingAgreement": {
      "option": "DELAY_TO_CANCEL",
      "delay": "6D"
    }
  }
}

,这是我的API响应。PNR生成成功/

stdClass Object
(
    [warnings] => Array
        (
            [0] => stdClass Object
                (
                    [status] => 200
                    [code] => 0
                    [title] => ContactInfoSsrNotAddedToBookingWarning
                    [detail] => Unable to create some contact information SSR. Email and mobile phone number required.
                )
        )
    [data] => stdClass Object
        (
            [type] => flight-order
            [id] => eJzTd9f3cg228PcBAAskAls%3D
            [associatedRecords] => Array
                (
                    [0] => stdClass Object
                        (
                            [reference] => JES8OL
                            [creationDate] => 2021-07-23T10:28:00.000
                            [originSystemCode] => GDS
                            [flightOfferId] => 5
                        )
                )
            [flightOffers] => Array
                (
                    [0] => stdClass Object
                        (
                            [type] => flight-offer
                            [id] => 5
                            [source] => GDS
                            [nonHomogeneous] => 
                            [lastTicketingDate] => 2021-07-23
                            [itineraries] => Array
                        

但是当我用不同的城市搜索,遵循相同的步骤。这是我的请求json

 data": {
    "type": "flight-order",
    "flightOffers": [
      {
        "type": "flight-offer",
        "id": "3",
        "source": "GDS",
        "instantTicketingRequired": false,
        "nonHomogeneous": false,
        "paymentCardRequired": false,
        "lastTicketingDate": "2021-07-28",
        "itineraries": [
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "DEL",
                  "terminal": "3",
                  "at": "2021-08-05T05:35:00"
                },
                "arrival": {
                  "iataCode": "BLR",
                  "at": "2021-08-05T08:20:00"
                },
                "carrierCode": "AI",
                "number": "803",
                "aircraft": {
                  "code": "32B"
                },
                "operating": {
                  "carrierCode": "AI"
                },
                "duration": "PT2H45M",
                "id": "17",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 145,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT2H45M"
          },
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "BLR",
                  "at": "2021-08-10T17:10:00"
                },
                "arrival": {
                  "iataCode": "DEL",
                  "terminal": "3",
                  "at": "2021-08-10T19:55:00"
                },
                "carrierCode": "AI",
                "number": "501",
                "aircraft": {
                  "code": "32B"
                },
                "operating": {
                  "carrierCode": "AI"
                },
                "duration": "PT2H45M",
                "id": "42",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 145,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT2H45M"
          }
        ],
        "price": {
          "currency": "USD",
          "total": "88.59",
          "base": "68.00",
          "fees": [
            {
              "amount": "0.00",
              "type": "SUPPLIER"
            },
            {
              "amount": "0.00",
              "type": "TICKETING"
            },
            {
              "amount": "0.00",
              "type": "FORM_OF_PAYMENT"
            }
          ],
          "grandTotal": "88.59",
          "billingCurrency": "USD"
        },
        "pricingOptions": {
          "fareType": [
            "PUBLISHED"
          ],
          "includedCheckedBagsOnly": true
        },
        "validatingAirlineCodes": [
          "AI"
        ],
        "travelerPricings": [
          {
            "travelerId": "1",
            "fareOption": "STANDARD",
            "travelerType": "ADULT",
            "price": {
              "currency": "USD",
              "total": "88.59",
              "base": "68.00",
              "taxes": [
                {
                  "amount": "6.34",
                  "code": "P2"
                },
                {
                  "amount": "3.78",
                  "code": "IN"
                },
                {
                  "amount": "3.63",
                  "code": "K3"
                },
                {
                  "amount": "2.28",
                  "code": "WO"
                },
                {
                  "amount": "4.56",
                  "code": "YR"
                }
              ],
              "refundableTaxes": "17.19"
            },
            "fareDetailsBySegment": [
              {
                "segmentId": "17",
                "cabin": "ECONOMY",
                "fareBasis": "SAP8",
                "class": "S",
                "includedCheckedBags": {
                  "weight": 25,
                  "weightUnit": "KG"
                }
              },
              {
                "segmentId": "42",
                "cabin": "ECONOMY",
                "fareBasis": "SAP8",
                "class": "S",
                "includedCheckedBags": {
                  "weight": 25,
                  "weightUnit": "KG"
                }
              }
            ]
          }
        ]
      }
    ],
    "travelers": [
      {
        "id": 1,
        "dateOfBirth": "**********",
        "name": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "gender": "**********"
      }
    ],
    "contacts": [
      {
        "addresseeName": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "purpose": "STANDARD",
        "emailAddress": "**********",
        "phones": [
          {
            "deviceType": "**********",
            "countryCallingCode": "**",
            "number": "**********"
          }
        ],
        "address": {
          "lines": [
            "**********"
          ],
          "postalCode": "**********",
          "cityName": "**********",
          "countryCode": "**********"
        }
      }
    ],
    "remarks": {
      "general": [
        {
          "subType": "GENERAL_MISCELLANEOUS",
          "text": "ONLINE BOOKING FROM INCREIBLE VIAJES"
        }
      ]
    },
    "ticketingAgreement": {
      "option": "DELAY_TO_CANCEL",
      "delay": "6D"
    }
  }

这是我的API响应

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [status] => 400
                    [code] => 34651
                    [title] => SEGMENT SELL FAILURE
                    [detail] => Could not sell segment 2
                    [source] => stdClass Object
                        (
                            [pointer] => /data/flightOffers[0]/itineraries[1]/segments[0]
                        )
                )
        )
)

你能告诉我是什么问题吗?我正在使用amadeus测试API证书。也指导我如何解决这个问题谢谢你

您通常在尝试预订不再可用的座位时得到此错误。您正在使用测试环境,这意味着在测试中使用Amadeus for developer的其他人可以尝试预订相同的座位。

尝试其他航班,在预订前不要忘记执行航班优惠价格。

PS:我在上面的例子中看到了一些个人数据,你应该编辑你的帖子来删除它。

相关内容

  • 没有找到相关文章

最新更新