Inspiration

Working on document-driven customer onboarding showed us how much time teams spend reading uploaded files, extracting information, and resolving inconsistencies. We wanted to bring that experience to a problem closer to payment execution: turning commercial documents into an actionable, reviewed payment plan.

A contract might specify a 30% deposit while listing the wrong dollar amount. A purchase order might authorize a different total. These small inconsistencies can delay payments or lead to costly mistakes.

We built Contract Compiler to connect document understanding, human judgment, and PayPal payments in one workflow.

What it does

Contract Compiler helps a service provider’s finance team review a Statement of Work and a customer-issued Purchase Order before requesting payment.

The workflow is straightforward:

  1. Upload documents: A billing analyst provides the SOW and Purchase Order.
  2. Extract commercial terms: The document-processing layer identifies amounts, currency, milestones, and supporting evidence.
  3. Reconcile discrepancies: Deterministic checks compare the extracted terms and flag inconsistent calculations.
  4. Review and approve: A human resolves the discrepancy and approves the transaction plan.
  5. Authorize through PayPal: The buyer approves a Sandbox payment authorization.
  6. Capture after acceptance: The operator confirms acceptance evidence has been reviewed and separately approves capture. Our example uses a $3,000 engagement with a 30% deposit incorrectly written as $800. The listed milestones total $2,900. Correcting the deposit to $900 restores the $3,000 schedule.

The prototype then demonstrates authorization and capture of the full $3,000 engagement. Separate installment collection is future work.

How we built it

We built the application with React, TypeScript, and server-side API routes.

The Amazon Bedrock integration classifies PDFs and extracts structured commercial terms, confidence values, and source citations. Schema validation checks the returned structure, while deterministic TypeScript logic performs financial reconciliation.

The prototype also provides an explicitly labeled sample-analysis mode for reproducible demonstrations. Our recorded walkthrough uses this mode; live Bedrock processing requires AWS configuration.

PayPal is central to execution. We integrated:

  • PayPal JavaScript SDK v6 for buyer approval.
  • Orders v2 API to create and authorize Sandbox orders.
  • Payments API to capture an authorization.
  • Server-side OAuth to authenticate API requests. We also prepared a Postman collection for testing the application’s API workflow and documented setup, architecture, and demo steps.

Challenges we ran into

The biggest design challenge was defining where AI assistance should end and human control should begin. We kept extraction, arithmetic validation, transaction approval, and payment execution as distinct steps.

Repeated Sandbox demonstrations also exposed the importance of request identity. Reusing an order-creation idempotency key could return an earlier order. We changed checkout attempts to use fresh keys while keeping authorization and capture requests tied to their respective transaction identifiers.

Another challenge was explaining authorization versus capture clearly: buyer approval does not mean the funds have already been captured.

Accomplishments that we're proud of

Completed an end-to-end PayPal Sandbox payment: We successfully authorized and captured a $3,000 transaction, then verified it in PayPal’s transaction activity. Made reconciliation actionable: The prototype flags a deposit mismatch and an inconsistent milestone total, helping a reviewer understand and resolve the issue before approving payment. Kept humans in control: Transaction-plan approval and final capture are separate steps, with an explicit acceptance-evidence confirmation before capture. Built a structured AI integration: Our Bedrock processing path combines document classification, structured extraction, source citations, and schema validation with deterministic financial checks. Created a reproducible demonstration: Sample documents, an explicit demo mode, architecture documentation, setup instructions, and a Postman collection make the workflow easier to understand and evaluate.

What we learned

Document extraction alone is not enough to make a payment workflow dependable. Extracted values need supporting evidence, deterministic checks, and an understandable approval process.

We also learned that a convincing payment prototype needs proof beyond a successful-looking interface. We verified a completed Sandbox capture in PayPal’s transaction activity.

What's next for Contract Compiler

We want to add authenticated reviewer roles, enforce separation between uploader and approver, persist the audit trail, and support acceptance-document uploads directly in the workflow.

We also plan to evaluate live Bedrock extraction across more document formats and expand from a single full-amount capture to milestone-based payments.

Our goal is simple: help businesses move from commercial paperwork to reviewed, traceable payments with less manual effort.

Built With

Share this project:

Updates

Submission history