### Create New Contact in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Provides an example of creating a new contact in Infusionsoft using the PHP SDK. This involves instantiating the Infusionsoft_Contact class and setting its properties before saving. ```php include('Infusionsoft/infusionsoft.php'); $contact = new Infusionsoft_Contact(); $contact->FirstName = 'John'; $contact->LastName = 'Doe'; $contact->save(); ``` -------------------------------- ### Create Order and Add Manual Payment in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples An example of creating a blank order and then adding a manual payment to it using the Infusionsoft PHP SDK. This involves creating a contact, then an invoice, and finally adding the payment details. ```php $contact = new Infusionsoft_Contact(); $contact->FirstName = 'John'; $contact->LastName = 'Doe'; $contact->save(); $invoiceId = Infusionsoft_InvoiceService::createBlankOrder($contact->Id, "An Order", date('Ymd\TH:i:s')); Infusionsoft_InvoiceService::addOrderItem($invoiceId, $productId, 4, 3.99, 1, 'Order Item', ''); Infusionsoft_InvoiceService::addManualPayment($invoiceId, 3.99, date('Ymd\TH:i:s'), 'API', 'A Manual Payment from the API'); ``` -------------------------------- ### Query Order Items by Order ID in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Provides an example of querying for order items associated with a specific order ID using `Infusionsoft_DataService::query()` in PHP. This method is recommended for efficient data retrieval. ```php // The ID for the specific order. This is passed as $_GET['orderId'] to // shopping cart and order form thank you pages. $orderId = 123; $orderItems = Infusionsoft_DataService::query(new Infusionsoft_OrderItem(), array('OrderId' => $orderId)); foreach($orderItems as $orderItem) { // Each $orderItem will be an Infusionsoft_OrderItem object } ``` -------------------------------- ### Query Contact by ID in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Demonstrates how to retrieve a specific contact record by its ID using `Infusionsoft_DataService::query()` in PHP. It returns an array of contacts, and `array_shift` is used to get the first matching record. ```php $contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('Id' => 2)); $contact = array_shift($contacts); ``` -------------------------------- ### Create Contact Note in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Shows how to add a note (ContactAction) to an existing contact in Infusionsoft using the PHP SDK. This involves looking up a user by email to get their ID and then creating the ContactAction with relevant details. ```php // Lookup sales person in InfusionSoft by his email so we can use his ID later. $infusionSoftUserSearch = Infusionsoft_DataService::query( new Infusionsoft_User(), array( 'Email' => 'salesagent@mycomp.com' ) ); $infusionSoftUser = array_shift( $infusionSoftUserSearch ); $contactAction = new Infusionsoft_ContactAction(); $contactAction->ContactId = $contact->Id; $contactAction->UserID = $infusionSoftUser->Id; $contactAction->CompletionDate = date('Ymj\TG:i:s'); $contactAction->ActionDescription = 'My Note Title'; $contactAction->CreationNotes = 'My Note Description'; $contactAction->save(); ``` -------------------------------- ### Query Records with Custom Sorting using Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This example shows how to query records from Infusionsoft and sort the results based on a specified field in ascending or descending order. It includes configuration for the Infusionsoft application and demonstrates querying both contacts and invoices. ```php 'NY'), 'LastName', // order by field true, // ascending 100, // limit 0 // page ); // Query invoices ordered by total descending $invoices = Infusionsoft_DataService::queryWithOrderBy( new Infusionsoft_Invoice(), array('ContactId' => 12345), 'InvoiceTotal', false, // descending 50, 0 ); foreach($invoices as $invoice){ echo "Invoice #{$invoice->Id}: ${$invoice->InvoiceTotal}\n"; } // Outputs: Invoice #789: $1250.00 ?> ``` -------------------------------- ### Infusionsoft PHP SDK OAuth2 Authentication and Usage Source: https://github.com/novaksolutions/infusionsoft-php-sdk/blob/master/README.md Demonstrates how to authenticate with the Infusionsoft API using OAuth2. It includes steps for setting up error reporting, requiring necessary files, configuring the redirect URI, processing authentication responses, connecting to the app, and performing a basic contact query. This example saves tokens to a file automatically. ```php // This makes troubleshooting MUCH easier during testing. Remove these lines in production. ini_set('display_errors', 1); error_reporting(E_ALL); // Load Infusionsoft require 'Infusionsoft/infusionsoft.php'; // Load config file (copy config.sample.php to config.php and put your clientid (key) and secret in. require 'config.php'; // Sets the redirect url to the current url Infusionsoft_OAuth2::$redirectUri = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; // When this is called, it will process the authentication response, convert the OAuth2 GET params to your access and refresh tokens. And then save them. Infusionsoft_OAuth2::processAuthenticationResponseIfPresent(); // If you don't specify a hostname, connect() will load the hostname automatically from the saved file. Note, this library does support multiple apps, so, if you authenticate to more then one app, you really should specify the app to connect to. $app = Infusionsoft_App::connect(); // If we just got back from the OAuth page... if(!$app->hasTokens()){ header("Location: " . Infusionsoft_OAuth2::getAuthorizationUrl()); //Send To OAuth Page... die(); } $results = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('FirstName' => '%'), 2); ?>
``` -------------------------------- ### Upload File to Infusionsoft Filebox with PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet shows how to upload a file to the Infusionsoft filebox using the PHP SDK. It reads the file content, base64 encodes it, and then uses the uploadFile method. The code provides two examples: one for uploading to the general filebox and another for associating the file with a specific contact. ```php $filename = '/www/picture.jpg'; $data = base64_encode(file_get_contents($filename)); Infusionsoft_FileService::uploadFile(null, 'picture.jpg', $data); ``` ```php $filename = '/www/picture.jpg'; $data = base64_encode(file_get_contents($filename)); Infusionsoft_FileService::uploadFile(8, 'picture.jpg', $data); ``` -------------------------------- ### PHP: Count Infusionsoft Records with DataService Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Demonstrates how to count records matching specific criteria using the Infusionsoft DataService without retrieving the full data. Useful for getting statistics or checking the number of matching records. ```php 'CA') ); echo "Total contacts in California: $count\n"; // Outputs: Total contacts in California: 1523 // Count contacts with specific email domain $count = Infusionsoft_DataService::count( new Infusionsoft_Contact(), array('Email' => '%@gmail.com') ); echo "Gmail contacts: $count\n"; // Outputs: Gmail contacts: 842 ``` -------------------------------- ### Add and Query Custom Fields with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This example demonstrates how to add support for custom fields to Infusionsoft objects dynamically using the PHP SDK. It shows how to add single or multiple custom fields and then query records, including filtering and retrieving data from these custom fields. ```php addCustomField('_CustomFieldName'); // Add multiple custom fields $contact->addCustomFields(array('_MembershipLevel', '_PreferredContact', '_LeadScore')); // Query including custom fields $contacts = Infusionsoft_DataService::query( $contact, array('_MembershipLevel' => 'Gold'), 100, 0 ); foreach($contacts as $c){ echo "{$c->FirstName} {$c->LastName} - Level: {$c->_MembershipLevel}\n"; } // Outputs: John Smith - Level: Gold ?> ``` -------------------------------- ### Increment Custom Field '_LeadScore' in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples An example of incrementing a custom field value (specifically '_LeadScore') for a contact. This snippet includes an HTML form to get the ContactId and then updates the field via the SDK. ```php
ContactId:

_LeadScore = $contact->_LeadScore + 1; $contact->save(); echo 'Lead Score for Contact: ' . $contact->FirstName . ' ' . $contact->LastName . ' is now: ' . $contact->_LeadScore; } ``` -------------------------------- ### Update Existing Contact using Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This example demonstrates how to load an existing contact by its ID and update its fields using the Infusionsoft PHP SDK. After modifying the desired properties, the save method is called to persist the changes to the Infusionsoft record. ```php Email}\n"; // Outputs: Current email: old@example.com // Update fields $contact->Email = 'newemail@example.com'; $contact->Phone2 = '555-987-6543'; $contact->JobTitle = 'Marketing Director'; // Save updates existing record $contact->save(); echo "Updated email: {$contact->Email}\n"; // Outputs: Updated email: newemail@example.com ?> ``` -------------------------------- ### Get Product Inventory with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This snippet illustrates how to retrieve the current inventory level for a specific product using the Infusionsoft PHP SDK. It requires a product ID and returns the number of units available in stock. The output displays the product ID and its inventory count. ```php ``` -------------------------------- ### Update Product Inventory with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This example demonstrates how to set a product's inventory to a specific level using the Infusionsoft PHP SDK. It takes the product ID and the desired new inventory count. The code first retrieves the current inventory, then updates it, and finally displays the updated inventory level. ```php ``` -------------------------------- ### Get All IDs from Saved Search with Infusionsoft PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet demonstrates how to retrieve all contact IDs from a saved search in Infusionsoft. It uses a do-while loop to paginate through the search results, fetching IDs page by page until no more results are returned. This is useful for bulk operations on contacts identified by a saved search. ```php $page = 0; do{ $results = Infusionsoft_SearchService::getSavedSearchResults($saved_search_id, $saved_search_user_id, $page, array('Id')); $all_ids = array_merge($results, $all_ids); $page++; }while(count($results) > 0); var_dump($all_ids); ``` -------------------------------- ### Delete Subscription with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This code example shows how to cancel a recurring order subscription using the Infusionsoft PHP SDK. It takes the subscription ID as input and handles potential exceptions during the cancellation process. A success message or an error message is outputted. ```php getMessage() . "\n"; } // Outputs: Subscription 7890 cancelled successfully ?> ``` -------------------------------- ### Get Values for Custom Field with Infusionsoft PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet demonstrates how to retrieve the available values for a specific custom field associated with a contact in Infusionsoft. It retrieves a custom field object and then calls its getValues() method. Note that this will throw an exception if the custom field does not support values. ```php //$customField will be an instance of an Infusionsoft_DataFormField $customField = Infusionsoft_CustomFieldService::getCustomField(new Infusionsoft_Contact(), '_SomeCustomField'); $fieldValues = $customField->getValues(); ``` -------------------------------- ### Create Subscription and Charge Credit Card with Infusionsoft PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet demonstrates how to create a credit card object, a subscription plan, and then use these to create a recurring order and charge an invoice. It requires valid contact and product IDs, along with credit card details. The process involves multiple steps and service calls within the SDK. ```php $creditCard = new Infusionsoft_CreditCard(); $creditCard->ContactId = $contact->Id; $creditCard->BillName = $contact->FirstName . ' ' . $contact->LastName; $creditCard->FirstName = $contact->FirstName; $creditCard->LastName = $contact->LastName; $creditCard->CardNumber = 1234567890123456; $creditCard->CVV2 = 197; $creditCard->CardType = 'Visa'; $creditCard->Status = 3; //0: Unknown, 1: Invalid, 2: Deleted, 3: Valid/Good, 4: Inactive $creditCard->save(); $subscriptionPlan = new Infusionsoft_SubscriptionPlan(); $subscriptionPlan->ProductId = 5; $subscriptionPlan->Cycle = 3; $subscriptionPlan->Frequency = 1; $subscriptionPlan->Prorate = 0; $subscriptionPlan->Active = 1; $subscriptionPlan->PlanPrice = 499.99; $subscriptionPlan->save(); // addReccuringOrder($contactId, $allowDuplicate, $cProgramId, $qty, $price, $allowTax, $merchantAccountId, $creditCardId, $affiliateId, $daysTillCharge, Infusionsoft_App $app = null) $subscriptionId = Infusionsoft_InvoiceService::addRecurringOrder($contact->Id, false, $subscriptionPlan->Id, 1, 19.99, false, 3, $creditCard->Id, 0, 0); // Create an invoice for the recurring order. $invoiceId = Infusionsoft_InvoiceService::createInvoiceForRecurring($subscriptionId); // Charge the invoice // chargeInvoice($invoiceId, $notes, $creditCardId, $merchantAccountId, $bypassCommissions, Infusionsoft_App $app = null) $charge = Infusionsoft_InvoiceService::chargeInvoice($invoiceId, 'Test payment', $creditCard->Id, 3, false); ``` -------------------------------- ### PHP Multi-App Support with Infusionsoft SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Demonstrates how to configure and use multiple Infusionsoft applications within the SDK. It shows initializing different app connections, querying data from each app, and saving modified objects back to their original applications. This feature requires identical custom fields across apps or manual field management. ```php $app1 = new Infusionsoft_App('ii130.infusionsoft.com', 'key'); $app2 = new Infusionsoft_App('jd567.infusionsoft.com', 'key'); $contactsFromApp1 = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array(...), 1000, 0, false, $app1); $contactsFromApp2 = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array(...), 1000, 0, false, $app2); $contactFromApp1 = array_shift($contactsFromApp1); $contactFromApp1->Phone1 = '555-555-5555'; $contactFromApp2 = array_shift($contactsFromApp2); $contactFromApp1->Email = 'bob@bob.com'; //Objects automatically keep track of what app they are from, so when you save them, it goes to the right app. $contactFromApp1->save(); $contactFromApp2->save(); ``` -------------------------------- ### Create New Opportunity (Lead) in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Illustrates how to create a new opportunity, referred to as a 'Lead' in the Infusionsoft API, using the PHP SDK. It requires an existing Contact ID and sets opportunity-specific details before saving. ```php include('Infusionsoft/infusionsoft.php'); //In the Infusionsoft API, Opportunities are called leads. $opportunity = new Infusionsoft_Lead(); $opportunity->ContactID = $contact->Id; $opportunity->OpportunityTitle = 'A Sweet Chance to make Millions of Dollars!'; $opportunity->OpportunityNotes = 'I saw a sign next to the road that said "Real Estate Apprentice Wanted"'; $opportunity->save(); ``` -------------------------------- ### Infusionsoft PHP SDK Basic Bootstrapper Source: https://github.com/novaksolutions/infusionsoft-php-sdk/blob/master/README.md A minimal PHP script to include the Infusionsoft SDK, which automatically loads necessary classes. This is a prerequisite for using the SDK's functionalities. ```php FirstName; // Outputs: Bob // Update and save contact $contact->FirstName = 'Robert'; $contact->LastName = 'Smith'; $contact->Email = 'robert@example.com'; $contact->save(); echo $contact->Id; // Outputs: 78649 ``` -------------------------------- ### Clone Infusionsoft PHP SDK Repository Source: https://github.com/novaksolutions/infusionsoft-php-sdk/blob/master/README.md Instructions for cloning the Infusionsoft PHP SDK repository using Git. It provides two methods: SSH for authenticated users and HTTPS as a fallback for public access or when SSH keys are not set up. ```shell git clone git@github.com:novaksolutions/infusionsoft-php-sdk.git ``` ```shell git clone https://github.com/novaksolutions/infusionsoft-php-sdk.git ``` -------------------------------- ### Run Action Sequence with Infusionsoft PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet shows how to trigger an action sequence for a specific contact using the Infusionsoft PHP SDK. It requires the contact ID and the action set ID to be provided. ```php Infusionsoft_ContactService::runActionSequence($contactId, $actionSetId); ``` -------------------------------- ### Email Opt-In API Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This API endpoint allows you to opt an email address into receiving marketing emails. It requires the email address and a reason for opting in. ```APIDOC ## Opt-In Email Address ### Description Opt an email address into receiving marketing emails. ### Method POST (assumed, based on SDK method) ### Endpoint /v1/emails/opt-in (assumed, based on SDK method) ### Parameters #### Query Parameters - **email** (string) - Required - The email address to opt in. - **reason** (string) - Required - The reason for opting in. ### Request Example ```php getMessage() . "\n"; } ?> ``` ### Response #### Success Response (200) - **optInResult** (boolean) - True if opt-in was successful. #### Response Example ```json { "optInResult": true } ``` ``` -------------------------------- ### PHP Query Linked Contact Types with Infusionsoft SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Shows how to query and retrieve all available linked contact types using the Infusionsoft PHP SDK. This snippet includes the necessary include statement for the SDK and demonstrates a basic query for all linked contact types by their ID. The result is then output using var_dump. ```php include('../infusionsoft.php'); $linkedContactTypes = Infusionsoft_DataService::query(new Infusionsoft_LinkedContactType(), array('Id' => '%')); var_dump($linkedContactTypes); ``` -------------------------------- ### PHP: Query Contacts using Infusionsoft DataService Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Illustrates how to query contacts using the Infusionsoft DataService with various criteria, including exact matches, wildcard pattern matching, and IN statements. Supports fetching multiple records with limit and pagination. ```php 'Bob', 'LastName' => 'Doe'), 1000, // limit 0 // page ); // Query with wildcard pattern matching $contacts = Infusionsoft_DataService::query( new Infusionsoft_Contact(), array('Email' => '%@example.com'), 100, 0 ); // Query using IN statement $contacts = Infusionsoft_DataService::query( new Infusionsoft_Contact(), array('Id' => array(3, 5, 7, 9, 11)) ); foreach($contacts as $contact){ echo "{$contact->FirstName} {$contact->LastName} - {$contact->Email}\n"; } ``` -------------------------------- ### Load and Update Contact in PHP Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples Demonstrates loading an existing contact by ID and then modifying its properties (e.g., name) before saving the changes using the Infusionsoft PHP SDK. Requires the contact ID to be known. ```php include('Infusionsoft/infusionsoft.php'); $contact = new Infusionsoft_Contact($id); $contact->FirstName = 'John Boy'; $contact->LastName = 'Walton'; $contact->save(); ``` -------------------------------- ### Create Blank Order with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Creates a new blank order (invoice) for a specified contact. This function requires the Infusionsoft SDK, an authenticated app instance, contact ID, description, order date, and affiliate IDs. It returns the ID of the newly created invoice. ```php getMessage() . "\n"; } // Outputs: Email customer@example.com opted in successfully ?> ``` -------------------------------- ### PHP: OAuth2 Authentication for Infusionsoft API Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Demonstrates how to authenticate with the Infusionsoft API using OAuth2. It handles token storage, refresh, and redirects to the authorization URL if tokens are not present. Requires PHP with cURL and ForceUTF8 package. ```php hasTokens()){ header("Location: " . Infusionsoft_OAuth2::getAuthorizationUrl()); die(); } // Now you can make API calls $contact = new Infusionsoft_Contact(12345); echo $contact->FirstName; // Outputs: Contact's first name ``` -------------------------------- ### Search Contacts by Field with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This snippet demonstrates how to find contacts using the Infusionsoft PHP SDK by specifying a field and its value. It supports pagination and allows specifying return fields. Ensure the Infusionsoft SDK is included and the application is configured. ```php Id}, Name: {$contact->FirstName} {$contact->LastName}\n"; } // Outputs: ID: 456, Name: John Smith ?> ``` -------------------------------- ### Create New Contact with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This code snippet illustrates how to create a new contact record in Infusionsoft using the PHP SDK. It involves instantiating a new Contact object, setting its properties, and then calling the save method to persist the record. The ID of the newly created contact is returned. ```php FirstName = 'Jane'; $contact->LastName = 'Doe'; $contact->Email = 'jane.doe@example.com'; $contact->Phone1 = '555-123-4567'; $contact->StreetAddress1 = '123 Main St'; $contact->City = 'San Francisco'; $contact->State = 'CA'; $contact->PostalCode = '94102'; $contact->Company = 'Acme Inc'; // Save creates new record and populates ID $newId = $contact->save(); echo "Created contact with ID: {$contact->Id}\n"; // Outputs: Created contact with ID: 98765 echo "Return value: $newId\n"; // Outputs: Return value: 98765 ?> ``` -------------------------------- ### Create Recurring Order (Subscription) with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This snippet demonstrates how to create a new recurring order (subscription) for a contact using the Infusionsoft PHP SDK. It requires contact ID, subscription plan ID, credit card details, and merchant account information. The function returns the ID of the created subscription. ```php ``` -------------------------------- ### Charge Invoice with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Charges a credit card on file for an existing invoice. Requires the Infusionsoft SDK, an authenticated app instance, invoice ID, credit card ID, merchant account ID, and optional notes. It returns an array indicating success or failure, including the charged amount and transaction ID. ```php getMessage() . "\n"; } // Outputs: Charged $199.98 successfully // Transaction ID: TXN123456789 ``` -------------------------------- ### Search Contacts with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Intelligently searches for contacts using names, emails, or phone numbers with progressive fallback logic. It requires the Infusionsoft SDK and an authenticated app instance. Input can be a full name, email, phone number, or partial name, and the output is an array of contact objects. ```php FirstName} {$contact->LastName} ({$contact->Email})\n"; } // Outputs: Found: John Smith (john@example.com) ``` -------------------------------- ### Format Dates for API Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This utility function formats human-readable dates into the format required by the Infusionsoft API. It supports various input date formats. ```APIDOC ## Format Dates for API ### Description Convert human-readable dates to Infusionsoft API format. ### Method Static method call ### Endpoint N/A ### Parameters #### Static Parameters - **dateString** (string) - Required - The date string to format. Can be in various human-readable formats. ### Request Example ```php Birthday = Infusionsoft_App::formatDate('1985-05-20'); $contact->save(); ?> ``` ### Response #### Success Response (N/A) - **formattedDate** (string) - The date string formatted according to Infusionsoft API standards (YYYYMMDDTHH:MM:SS). #### Response Example ```json "20231015T14:30:00" ``` ``` -------------------------------- ### Add Manual Payment to Invoice with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Records a manual payment (e.g., cash, check, external) to an invoice. This function needs the Infusionsoft SDK, an authenticated app instance, invoice ID, payment amount, date, type, description, and a flag to bypass commissions. It returns a confirmation message. ```php ``` -------------------------------- ### Email Opt-Out API Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This API endpoint allows you to opt an email address out of marketing emails. It requires the email address and a reason for opting out. ```APIDOC ## Opt-Out Email Address ### Description Opt an email address out of marketing emails. ### Method POST (assumed, based on SDK method) ### Endpoint /v1/emails/opt-out (assumed, based on SDK method) ### Parameters #### Query Parameters - **email** (string) - Required - The email address to opt out. - **reason** (string) - Required - The reason for opting out. ### Request Example ```php ``` ### Response #### Success Response (200) - **optOutResult** (boolean) - True if opt-out was successful. #### Response Example ```json { "optOutResult": true } ``` ``` -------------------------------- ### Format Dates for Infusionsoft API using PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Convert human-readable dates and times into the format required by the Infusionsoft API using the SDK's `formatDate` method. This function can handle various input formats, including standard YYYY-MM-DD HH:MM:SS, 'Month Day, Year', and relative terms like 'next Monday'. The formatted output is suitable for use in API calls, such as setting contact birthdays. ```php Birthday = Infusionsoft_App::formatDate('1985-05-20'); $contact->save(); ?> ``` -------------------------------- ### Send Email Template to Contacts with Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This snippet shows how to send a pre-defined email template to a list of contacts using the Infusionsoft PHP SDK. It requires a list of contact IDs and the ID of the email template to be sent. The function returns a result indicating the success of the operation. ```php ``` -------------------------------- ### Request Credit Card Submission Token using Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Generate a secure token for PCI-compliant credit card collection via a hosted form using the Infusionsoft PHP SDK. This involves providing a contact ID and URLs for success and failure callbacks. The SDK also provides the URL to post the credit card data to. ```php ``` -------------------------------- ### Add Tag to Contact with Infusionsoft PHP SDK Source: https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples This snippet demonstrates how to add a tag (referred to as a group in Infusionsoft API) to an existing contact using the Infusionsoft PHP SDK. It requires the contact ID and the group (tag) ID as parameters for the addToGroup method in ContactService. ```php $contactID = 40; // A valid ID for an existing contact $groupID = 119; // A valid ID for an existing tag Infusionsoft_ContactService::addToGroup($contactID, $groupID); ``` -------------------------------- ### Enable Debug Mode for API Calls in PHP Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt This PHP code snippet shows how to enable debug mode in the Infusionsoft SDK. Enabling debug mode prints the XML-RPC payloads for API requests and responses, which is useful for troubleshooting and understanding API communication. ```php enableDebug(); // Make API calls - XML request/response will be printed $contact = new Infusionsoft_Contact(12345); echo $contact->FirstName; // Output shows: // --- // ---GOT--- // // // DataService.load // ... ``` -------------------------------- ### Opt-Out Email Address using Infusionsoft PHP SDK Source: https://context7.com/novaksolutions/infusionsoft-php-sdk/llms.txt Opt an email address out of marketing emails using the Infusionsoft PHP SDK. This function requires the email address and the reason for opting out. It's a straightforward call to the email service. ```php ```