● Travel Never Stops. Neither Do We. 365 Days a Year.

Amadeus API Integration in PHP with Contract Fixtures

Build read-only PHP adapter tests that keep travel data mapping predictable when search responses differ by source or environment.

Developers review printed test materials between two laptops

For an Amadeus API integration PHP application, agree on the authorized interface and its message shape before choosing a client library. A useful adapter test answers whether the same verified travel facts survive valid, incomplete and revised input. It also shows which errors prevent the application from interpreting a response. Start with a read-only test around flight search, a small collection of synthetic fixtures and a comparison of field meanings. The same preparation supports later supplier approval work without claiming that a successful local test proves commercial access.

Take a fictional seller called Baycoil. Its former demonstration used older public materials. The planned application has a separately authorized enterprise interface whose response definitions the supplier must confirm. A developer receives synthetic evidence for two results, one complete and one with optional fields omitted. A later contract replaces an amount representation without changing the meaning of the price. Baycoil needs to decide which client or provider fields it can support and when an ambiguous result must stop at the adapter boundary.

Separate public examples from the active Amadeus agreement

The Amadeus API catalogue identifies the public site as the Enterprise API Portal after decommissioning the Self-Service portal. Confirm the current programme, contracted products, environment and accounts with Amadeus or your contracted provider. Do not assume that archivable documentation, an old test URL or previously issued credentials establish support for a new deployment. Ask the supplier for the intended transport, authentication and the scope of permitted operations. Adopt code or build a client only after confirming which agreement applies.

Write down which functions the first exercise covers. A read-only adapter can parse selected flight observations, normalize approved fields and provide errors meaningful to the calling service. An authorized booking action needs its own source interface, credentials and validation. Domain experts can review the search fixture without seeing partner credentials or sending live transactions. If the design includes industry records from another source, preserve its own mapping rather than adding fields whose names happen to match. Treat product, environment and account as part of the contract being tested.

Create a small input contract visible to team members

Document five to eight facts that a supported search must return. Baycoil's case uses itinerary reference, airport references, local departure date, carrier evidence and total in a stated currency. Describe which fields must exist, which can be null and which are only explanatory. Decide how the fixture represents an absent field separately from a present but unknown value. Record account and operation scope outside the raw payload if the provider includes them in request metadata instead. The developer can then see which inputs the adapter will be expected to use before PHP is involved.

First four PHP adapter fixtures for the Baycoil exercise
FixtureShape or evidenceExpected application interpretation
Complete resultKnown route, amount, currency and two air segmentsMap the approved fields and preserve itinerary scope
Optional fields absentReturned operating detail is unavailable in one segmentRecord unknown where the business permits and document the missing field
Ambiguous totalPrice is shaped correctly but the currency is absentHold the result from priced display and provide a useful reason
Unexpected message shapeResponse reports an error instead of a search resultKeep provider and adapter error classes separate
Developer highlights rows on printed fixtures at a wooden desk

Map amount and route fields before writing HTTP code

Record whether amounts arrive as strings, an integer count of defined minor units or a structure containing separate fields. Match the representation described by the authorized contract. The application needs a currency and enough precision to show the same accepted amount. Avoid accidental conversion to binary floating point when it would lose business-defined decimal precision. For the exercise, make totals easy to reason about and create a second boundary amount where removing or adding a decimal digit would visibly affect display. Resolve how taxes and fees are represented with the product owner rather than inferring them from label similarity.

Build fixtures for a date with late departure and one with arrival the following local day. Verify the route using the expected local date, supported timezone facts and approved code mapping. Ask the travel owner which values the customer needs to see before proceeding. Code that assumes every time is UTC may appear correct through most samples in a single operating market. Document whether the response explicitly carries an offset or the integration needs a reference source. The field mapping should describe the decision and preserve upstream values useful for support.

Use tested parsing rules where PHP results can look similar

The PHP manual for json_decode covers accepted inputs and options including exceptions and integer handling. Distinguish a correctly decoded value that your schema rejects from invalid JSON. An optional object might be explicitly null or entirely absent. An expected array can be empty while another result unexpectedly returns a string. Check the expected field shape before normalizing it. Choose collection and object behavior deliberately. These local checks can be run against synthetic records without contacting any supplier endpoint.

For external identifiers, ask the supplier which form is stable and whether leading characters are meaningful. Treat a source reference as an identifier in the internal model when its business role calls for preserving its exact representation. Test a large numeric-looking value, a leading zero in a verified string shape and a mixed-character locator. If a source genuinely sends an oversized numeric value and the contract permits it, use a decoding strategy that preserves the information needed. Do not invent a correction for malformed fields. Log that an authorized feed returned a value the application cannot interpret safely.

Exercise a compact transport boundary for permitted requests

Design a narrow client responsible for preparing authorized requests and returning transport outcomes. The mapping code should be testable without that client. First run local replay from synthetic response files with the server disconnected. Then exercise the real authorized transport separately when account holders can provide the approved environment. Verify that endpoint, authentication method and operation are documented for the scoped account. Restrict diagnostic access and avoid putting credentials or live passenger information in fixtures. Include one case where the transport works correctly but the response itself describes an error.

Decide how to identify expiry of authorized connection material through the agreed channel. Test missing authorization with a simulated reply in local fixtures, without using real secrets in source code. Do not treat a missing credential as a no-results response. Establish which downstream job is allowed to request assistance and which operator can confirm a configuration problem. If the connector uses a sandbox, compare supported operations there to the accepted deployment scope. An authentication check in a read-only test should never assume that a sell or change action is authorized.

Define retry conditions before exposing them as UI choices

A preliminary retrieval may fail temporarily or receive a service-defined limit. Capture the exact nature of the simulated problem and respect your provider's documented behavior. Use an agreed retry policy for operations where repeating the request is acceptable. Make timeout, retry later, undeclared failure and invalid request distinct outcomes for consumers. A transaction with uncertain effects requires a separate recovery design. This read-only exercise deliberately does not use a single retry rule as a shortcut for booking or payment operations. Validate what the traveller learns from a temporarily incomplete search.

Compare parsed fields with an explicit acceptance file

Build a small outcome file for each fixture. State which rows are accepted, their normalized flight and date information, and which field led to a hold or warning. Verify that the normalized result retains product, account, operation and quote context that matter to your business. Choose object or array shapes the receiving application can verify easily. When a new supplier contract arrives, add a sample under its actual version instead of editing all of the old fixtures. Later review should be able to compare both expected behaviors, including any order in which old routes remain readable after a rollout.

Keep fixture filenames understandable to someone reading a failure report. A developer who sees a missing amount can investigate an amount fixture; the description should also identify whether it was a missing currency, unreadable decimal value or rejected rate limit. When a provider version changes, use two outcomes to separate adapter change from product change. One fixture can describe an amount reformatting expected to preserve every customer-visible result. Another can introduce a new eligibility requirement that legitimately changes the display. Make the distinction traceable to authorized documentation and selected approval.

Create the edge cases around an ordinary office task

Ask a travel product colleague to read the fixture where an offer spans two legs and one optional carrier field is absent. Give them the expected output and ask whether they would consider the offer acceptable for the intended shop. Repeat using an incomplete price. They should determine whether it is still possible to show availability without a clear total for the product. Organize the result around the real UI decision and retain the field interpretation in the fixture review. A parser test that records only that an exception occurred can miss the reason the product should care.

Check ordering and matching. Reverse the elements in a test payload and verify which associations should stay fixed. One party may be listed on the document as a participant with a durable ID; another provider may use a named reference that needs separate handling. Determine both outcomes from contract evidence rather than from a numeric index demonstrated by a single test. Validate that an empty collection remains different from a property the source has not reported. The organization can use the distinction to investigate why fare and availability decisions differ by connector or travel market.

Review mapped output with customer support before launch

Give support a case where two observations exist for one marketed flight. They should be able to find enough source context to explain the visible result and identify which integration can verify it. In the support training, avoid exposing raw transport payloads to staff who only need booking facts. Instead provide scoped fields with clear labels and observation time. Ask which state matters after a broken supplier connection or an unsupported request. A single temporary error message may be acceptable for a customer, while staff still need to know which credential and operations team will investigate the issue.

Use logging and monitoring to distinguish source-level connectivity from semantic failures in an adapter. A response can be delivered successfully and remain unusable because it lacks currency or its itinerary lacks required references. Count known invalid shapes, expected business rejections and successful comparisons independently. Include sample diagnostic information without full sensitive payloads. Compare the previous and new contract versions by valid record counts and typical error categories. Pick an escalation owner before enabling a wider account or flight family. The incident record should tell them which deployment to inspect.

Test the repair on both currently accepted versions

Suppose the supplier changes the format presenting a total while existing accounts still return the previous form. Add a fixture for each version. Set which deployed configuration will use the new parser and retain one release-gate comparison that proves the amount is unchanged. Try an undocumented shape to confirm it is not guessed. If the application can accept both and distinguish them reliably, choose an explicit mapping function rather than treating every field alike. Verify what the old records look like after the deployment and document how a support worker identifies the amount that was originally shown.

Keep supplier approval and engineering delivery distinct

Bring the provider's authorized interface sheet, representative response shapes, currently configured account capabilities and synthetic acceptance outcomes. Engineering can map fields, write adapters and build reporting for the agreed operations. Travel operations and the supplier own commercial permission, office eligibility and enabled functions. Plan for a boundary around any network checks so local tests remain useful even if access is pending. Review the existing Amadeus developer integration guide for project access context before committing to a production feature. If permission changes, preserve the earlier decision scope in release records and update which fixtures belong to the current contract.

End the pilot by demonstrating a complete test run with no external access. Then use the approved environment and allowed operations for a small functional confirmation. Compare test outcomes and record whether any differences need to be captured with new synthetic fixtures. A code sample adapted from a former public tutorial can still be a learning aid, while current deployment must follow the account and interface your team has been granted. Establishing that distinction is part of a deliverable that another PHP developer can reproduce.

Prove the project also handles mixed data quality

Prepare a mock file with a useful valid flight, a record with absent currency, and one returned under a documented error state. Verify whether the application should show the valid record and mark reduced coverage or stop the specific operation. Give the decision owner a clear set of observations rather than a pile of messages. The rule may depend on whether all data belonged to one authoritative transaction, or whether several independent offers can be considered individually. Explain which boundaries determine recovery. Build a second file where a malformed response prevents the team from identifying any flights reliably; the accepted outcome may need to be different.

Review the response contract in a pair session without editing code. A support analyst can ask a developer to explain the route's displayed carrier, local date and amount. The developer should be able to show the fixture and precise expected output. Then ask the analyst to resolve the ambiguous amount example using the product's approved queue. This establishes what the system did before you decide how to report it. A test designed from a staff task gives each person shared language for diagnosing a future support issue.

Use a brief rollout check after the first observed traffic. Compare outcome counts and source records with known test expectations, then examine an agreed sample of unactionable results. Add examples only for novel conditions or business decisions, with proper authorization and without unnecessary personal data. Keep each selected fixture stable and label the specific contract it illustrates. This gives the integration team distinct evidence for parsing, access and operations. It also makes future upgrades easier to discuss when a supplier changes a former field’s representation without changing the intent of the request.

Trace fixture change to a specific interpretation decision

Give the test owner a comparison of input contracts before accepting a change. They can list the two fields that have shifted, choose a preserved internal representation and identify the expected effect on one route. Ask whether the change has been documented by the authorized supplier or inferred from a response. An inference may be useful during investigation but must be validated before it determines a customer commitment. Create one case that uses the planned form and one that exposes an unexpected variant. Preserve the original samples where the contract allows or keep a safe substitute showing the same shape.

In the Baycoil example, the original field provides a numeric-looking string for the total. The updated fixture represents it as a structured value with currency. A business reviewer confirms that both synthetic fixtures describe the same amount for the same market. The implementation should produce a clear result or an actionable rejection for each version according to the configured interface. Use a test customer view to determine whether a change silently affects the displayed amount, its currency or the association between a selected fare and its travelling party. Test availability of relevant information under the approved credentials after a valid read-only deployment.

Test malformed and unsupported fields without external requests

Build a third file that looks superficially reasonable but lacks a property required to associate the price with a usable itinerary. The right normalization rejects the ambiguous record rather than routing it to the front end with a blank label. In the case of optional carrier evidence, the supported behavior may keep the result visible under the approved conditions. These two cases exercise separate rules. Store the expected interpretation next to the fixture, but keep the result of each run somewhere reviewers can compare without changing the expected file. Use configured timeouts and limits for transport exercises separately from simple mapping failures.

Where the product uses PHP associative arrays, rehearse what your code does with typed keys, an empty list and omitted fields. Get a second developer to interpret the fixtures and discover which record causes a warning without needing to read production logs. Before broad deployment, test the default output on a normal route and view one deliberately reduced result. Ask the travel owner whether a traveller can interpret what the output establishes about price and route. A precise local parser test gives you repeatable evidence of what facts survived, but the business needs to check what became visible as well.

Write a sustainable handover for the next developer

Include the active program and environment identifier in internal deliverables without including credentials. Define who updates agreement facts and who runs official partner acceptance. List the files that represent normal output, read-only failures and unsupported actions. Note which logging scope keeps sensitive material out of routine messages. A newcomer can then tell where to add a fixture for a field change, where to seek an approved supplier answer and how to interpret a successful local test. Leave a dated record of the documentation and interface that were relevant when the evidence was gathered.

Close the handover by having a developer who did not write the adapter reproduce the complete and ambiguous totals. Have them explain the error path for a valid transport that carries an unsupported result. Compare that answer with the product owner and confirm the role that can take the next action. Once those outcomes can be explained, the case can anchor future work on connected functions, including repricing and fulfilment where separately authorized. The contract fixtures remain useful because they cover specific travel decisions that staff can recognize.