<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'automatically_finalizes_at' => '2023-12-01T05:00:00.401Z',
'billing_address' => [
'city' => '<string>',
'country' => '<string>',
'line1' => '<string>',
'line2' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'tax_id_value' => '<string>'
],
'charge_buyer_fee' => true,
'customer_name' => '<string>',
'due_date' => '2023-12-01T05:00:00.401Z',
'email_address' => '<string>',
'line_items' => [
[
'label' => '<string>',
'unit_price' => 6.9,
'quantity' => 6.9
]
],
'mailing_address_id' => 'ma_xxxxxxxxxxxxxxx',
'member_id' => 'mber_xxxxxxxxxxxxx',
'payment_method_id' => 'pmt_xxxxxxxxxxxxxx',
'plan' => [
'adaptive_pricing_enabled' => true,
'billing_period' => 42,
'custom_fields' => [
[
'field_type' => 'text',
'name' => '<string>',
'id' => '<string>',
'order' => 42,
'placeholder' => '<string>',
'required' => true
]
],
'description' => '<string>',
'expiration_days' => 42,
'initial_price' => 6.9,
'internal_notes' => '<string>',
'legacy_payment_method_controls' => true,
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'renewal_price' => 6.9,
'stock' => 42,
'trial_period_days' => 42,
'unlimited_stock' => true
],
'product_id' => 'prod_xxxxxxxxxxxxx',
'subscription_billing_anchor_at' => '2023-12-01T05:00:00.401Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}