<?php
// FinanceGPT generated client starter
// Source: FinanceGPT API v2 OpenAPI index
// OpenAPI SHA-256: 228f3cf999f801d03634f0dad1fc6d296671bc13a8cf0d80994b00a57b62f910
// Operations: post-actions-credit-corporate-arrangements
// Credential: FINANCEGPT_API_KEY environment variable; no credential is embedded.
// Authority: API identity and generated code do not create model-promotion, QLM-binding or Financial Actions authority.

if (!getenv('FINANCEGPT_API_KEY')) { throw new RuntimeException('FINANCEGPT_API_KEY is required'); }

// Register an accepted settlement or repayment arrangement | scope: actions:create
$ch = curl_init('https://financegpt.dev/api/v2/actions/credit-corporate/arrangements');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer '.getenv('FINANCEGPT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(array (
  'obligation_uid' => '00000000-0000-4000-8000-000000000001',
  'arrangement_type' => 'string',
  'source_reference' => 'string',
  'source_hash' => 'string',
  'terms_hash' => 'string',
  'currency' => 'string',
  'agreed_amount' => 1.0,
  'discount_amount' => 0,
  'installment_count' => 1,
  'starts_on' => '2026-08-16',
  'expires_on' => '2026-08-16',
  'status' => 'string',
)),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
