### Cancel Installment Plan Example Source: https://useascend.readme.io/reference/cancelinstallmentplan Example of how to cancel an installment plan using various programming languages. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/installment_plans/{id}/cancel \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const cancelInstallmentPlan = async (planId, apiKey) => { try { const response = await axios.post(`https://sandbox.api.useascend.com/v1/installment_plans/${planId}/cancel`, {}, { headers: { 'Authorization': `Bearer ${apiKey}` } }); console.log('Installment plan cancelled:', response.data); return response.data; } catch (error) { console.error('Error cancelling installment plan:', error.response ? error.response.data : error.message); throw error; } }; // Example usage: // cancelInstallmentPlan('some-plan-id', 'YOUR_API_KEY'); ``` ```Ruby require 'httparty' class AscendAPI include HTTParty base_uri 'https://sandbox.api.useascend.com/v1' def initialize(api_key) @api_key = api_key end def cancel_installment_plan(plan_id) options = { headers: { 'Authorization' => "Bearer #{@api_key}" } } self.class.post("/installment_plans/#{plan_id}/cancel", options) end end # Example usage: # api = AscendAPI.new('YOUR_API_KEY') # response = api.cancel_installment_plan('some-plan-id') # puts response.parsed_response ``` ```PHP = 200 && $httpCode < 300) { return json_decode($response, true); } else { echo 'Error: ' . $response; return null; } } // Example usage: // $apiKey = 'YOUR_API_KEY'; // $planId = 'some-plan-id'; // $result = cancelInstallmentPlan($planId, $apiKey); // print_r($result); ?> ``` ```Python import requests def cancel_installment_plan(plan_id, api_key): url = f"https://sandbox.api.useascend.com/v1/installment_plans/{plan_id}/cancel" headers = { "Authorization": f"Bearer {api_key}" } try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error cancelling installment plan: {e}") return None # Example usage: # api_key = 'YOUR_API_KEY' # plan_id = 'some-plan-id' # result = cancel_installment_plan(plan_id, api_key) # print(result) ``` -------------------------------- ### Create a Return Example Source: https://useascend.readme.io/reference/post_v1-installment-plans-installment-plan-id-returns Example of how to create a return for an installment plan. Supports multiple client languages for integration. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' ``` ```Node const axios = require('axios'); const createReturn = async (installmentPlanId, apiKey) => { try { const response = await axios.post(`https://sandbox.api.useascend.com/v1/installment_plans/${installmentPlanId}/returns`, {}, { headers: { 'Authorization': `Bearer ${apiKey}` } }); return response.data; } catch (error) { console.error('Error creating return:', error); throw error; } }; ``` ```Ruby require 'httparty' class AscendAPI include HTTParty base_uri 'https://sandbox.api.useascend.com/v1' def initialize(api_key) @api_key = api_key end def create_installment_plan_return(installment_plan_id) self.class.post("/installment_plans/#{installment_plan_id}/returns", headers: { 'Authorization' => "Bearer #{@api_key}" }) end end # Usage: # api = AscendAPI.new('YOUR_API_KEY') # response = api.create_installment_plan_return('some_plan_id') ``` ```PHP ``` ```Python import requests def create_installment_plan_return(installment_plan_id, api_key): url = f"https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() # Usage: # api_key = 'YOUR_API_KEY' # plan_id = 'some_plan_id' # result = create_installment_plan_return(plan_id, api_key) # print(result) ``` -------------------------------- ### Get Program Example Source: https://useascend.readme.io/reference/getprogram Demonstrates how to retrieve program details using the UseAscend API. Includes examples for various programming languages and shell. ```APIDOC GET /v1/programs/{id} Retrieves a specific program by its ID. Parameters: - id (string, required): The unique identifier for the program. Base URL: https://sandbox.api.useascend.com/v1/ Authentication: Bearer token Example Request: GET https://sandbox.api.useascend.com/v1/programs/your_program_id Response: Details of the program, including its configuration and associated data. ``` ```Shell curl -X GET \ 'https://sandbox.api.useascend.com/v1/programs/your_program_id' \ -H 'Authorization: Bearer YOUR_API_TOKEN' ``` ```Node const axios = require('axios'); const getProgram = async (programId, token) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/programs/${programId}`, { headers: { 'Authorization': `Bearer ${token}` } }); return response.data; } catch (error) { console.error('Error fetching program:', error); throw error; } }; // Example usage: // getProgram('your_program_id', 'YOUR_API_TOKEN').then(data => console.log(data)); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/programs/your_program_id' headers = { 'Authorization' => 'Bearer YOUR_API_TOKEN' } response = HTTParty.get(url, headers: headers) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/programs/your_program_id'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_API_TOKEN' )); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $response; } curl_close($ch); ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/programs/your_program_id" headers = { "Authorization": "Bearer YOUR_API_TOKEN" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### Create Installment Plan Example Source: https://useascend.readme.io/reference/post_v1-installment-plans Demonstrates how to create an installment plan using the Ascend API. Includes details on the endpoint, HTTP method, and supported languages for integration. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/installment_plans \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const createInstallmentPlan = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/installment_plans', {}, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log('Installment plan created:', response.data); } catch (error) { console.error('Error creating installment plan:', error); } }; createInstallmentPlan(); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installment_plans' headers = { 'Authorization' => 'Bearer YOUR_API_KEY' } response = HTTParty.post(url, headers: headers) if response.success? puts "Installment plan created: #{response.parsed_response}" else puts "Error creating installment plan: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/installment_plans' headers = { 'Authorization': 'Bearer YOUR_API_KEY' } try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(f'Installment plan created: {response.json()}') except requests.exceptions.RequestException as e: print(f'Error creating installment plan: {e}') ``` -------------------------------- ### Get Installment Plan Example Source: https://useascend.readme.io/reference/installmentplans Demonstrates how to retrieve a specific installment plan using its ID. Includes examples in multiple languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/installment_plans/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getInstallmentPlan = async (id, token) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/installment_plans/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); return response.data; } catch (error) { console.error('Error fetching installment plan:', error); throw error; } }; ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installment_plans/' + id headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN' } response = HTTParty.get(url, headers: headers) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/installment_plans/' . $id); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_ACCESS_TOKEN' )); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = f"https://sandbox.api.useascend.com/v1/installment_plans/{id}" headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get User Example Source: https://useascend.readme.io/reference/getuser Demonstrates how to retrieve a specific user using the API. Includes example URLs and language options for implementation. ```APIDOC Get User: Method: GET URL: https://sandbox.api.useascend.com/v1/users/{id} Authentication: Bearer Token Parameters: - id: The unique identifier of the user to retrieve. Response: (Details available via 'Try It!' functionality in the original interface) ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/users/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const userId = 'some-user-id'; const accessToken = 'YOUR_ACCESS_TOKEN'; axios.get(`https://sandbox.api.useascend.com/v1/users/${userId}`, { headers: { 'Authorization': `Bearer ${accessToken}` } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching user:', error); }); ``` ```Python import requests user_id = 'some-user-id' access_token = 'YOUR_ACCESS_TOKEN' headers = { 'Authorization': f'Bearer {access_token}' } response = requests.get(f'https://sandbox.api.useascend.com/v1/users/{user_id}', headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error fetching user: {response.status_code} - {response.text}') ``` ```Ruby require 'httparty' user_id = 'some-user-id' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.get("https://sandbox.api.useascend.com/v1/users/#{user_id}", headers: { 'Authorization' => "Bearer #{access_token}" }) puts response.body ``` ```PHP $userId = 'some-user-id'; $accessToken = 'YOUR_ACCESS_TOKEN'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://sandbox.api.useascend.com/v1/users/{$userId}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $headers = array( 'Authorization: Bearer ' . $accessToken ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $response; } curl_close($ch); ``` -------------------------------- ### Get Contact Example Source: https://useascend.readme.io/reference/get_v1-contacts-id Example of how to retrieve contact information using the UseAscend API. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/contacts/{id} \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const getContact = async (contactId, apiKey) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/contacts/${contactId}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }); return response.data; } catch (error) { console.error('Error fetching contact:', error); throw error; } }; // Example usage: // getContact('some-contact-id', 'YOUR_API_KEY').then(data => console.log(data)); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/contacts/{id}' api_key = 'YOUR_API_KEY' response = HTTParty.get(url, headers: { 'Authorization' => "Bearer #{api_key}" }) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/contacts/{id}" api_key = "YOUR_API_KEY" headers = { "Authorization": f"Bearer {api_key}" } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Express.js Webhook Listener Example Source: https://useascend.readme.io/docs/webhooks A complete example of an Express.js application middleware to listen for, parse, and verify Ascend webhook requests. It includes body parsing, signature verification, and response handling. ```JavaScript app.use((req, res, next) => { // Do not use the webhook parser for the webhook route if (req.originalUrl === '/webhook-listener') { next(); } else { bodyParser.json()(req, res, next); } }); app.post( '/webhook-listener', bodyParser.raw({ type: 'application/json' }), (req, res) => { const requestBody = req.body; const requestTimestamp = req.header("X-Ascend-Request-Timestamp") const requestSignature = req.header("X-Ascend-Signature") const hmac = crypto.createHmac('sha256', SECRET) .update(`${requestTimestamp}:${requestBody}`) .digest('hex'); const expectedSignature = `t=${requestTimestamp},v1=${hmac}` const event = JSON.parse(requestBody); if (requestSignature == expectedSignature) { res.status(200).send('success!'); } else { res.status(500).send('error!') } } ) ``` -------------------------------- ### Get Billable Example Source: https://useascend.readme.io/reference/getbillable Demonstrates how to retrieve a specific billable item using the UseAscend API. This example shows the request structure and common language implementations. ```APIDOC GET https://sandbox.api.useascend.com/v1/billables/{id} Description: Retrieves a specific billable item by its ID. Parameters: - id (path parameter): The unique identifier for the billable item. Authentication: - Bearer Token Response: - Returns the billable item details upon success. ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/billables/{id} \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node.js const axios = require('axios'); const getBillable = async (id, apiKey) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/billables/${id}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }); return response.data; } catch (error) { console.error('Error fetching billable:', error); throw error; } }; // Example usage: // getBillable('billable_id', 'YOUR_API_KEY').then(data => console.log(data)); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/billables/' HTTParty.get(url + 'billable_id', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/billables/billable_id'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_API_KEY' )); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/billables/billable_id" headers = { "Authorization": "Bearer YOUR_API_KEY" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Create Program Example Source: https://useascend.readme.io/reference/createprogram Demonstrates how to create a new program using the UseAscend API. Includes examples for common programming languages and shell. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/programs \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node.js const axios = require('axios'); const createProgram = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/programs', {}, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log('Program created:', response.data); } catch (error) { console.error('Error creating program:', error.response.data); } }; createProgram(); ``` ```Ruby require 'httparty' response = HTTParty.post('https://sandbox.api.useascend.com/v1/programs', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) if response.success? puts "Program created: #{response.parsed_response}" else puts "Error creating program: #{response.parsed_response}" end ``` ```PHP ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/programs" headers = { "Authorization": "Bearer YOUR_API_KEY" } try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(f"Program created: {response.json()}") except requests.exceptions.RequestException as e: print(f"Error creating program: {e}") ``` -------------------------------- ### Get Installment Plan Example Source: https://useascend.readme.io/reference/get_v1-installment-plans-id Demonstrates how to retrieve a specific installment plan using its ID. Includes examples in multiple languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/installment_plans/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getInstallmentPlan = async (id, token) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/installment_plans/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); return response.data; } catch (error) { console.error('Error fetching installment plan:', error); throw error; } }; ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installment_plans/' + id headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN' } response = HTTParty.get(url, headers: headers) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/installment_plans/' . $id); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_ACCESS_TOKEN' )); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = f"https://sandbox.api.useascend.com/v1/installment_plans/{id}" headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### List Programs Example Source: https://useascend.readme.io/reference/listprograms Demonstrates how to list programs using the UseAscend API. Includes example configurations for different languages. ```APIDOC Endpoint: GET https://sandbox.api.useascend.com/v1/programs Description: Retrieves a list of programs. Authentication: Bearer Token Base URL: https://sandbox.api.useascend.com/v1/programs Example Usage: This section provides examples for making the GET request in various languages. (Actual code examples for each language are not provided in the source text, only the intent is mentioned.) ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/programs \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node // Example using fetch API in Node.js fetch('https://sandbox.api.useascend.com/v1/programs', { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` ```Ruby # Example using Net::HTTP in Ruby require 'net/http' require 'uri' uri = URI.parse('https://sandbox.api.useascend.com/v1/programs') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) request['Authorization'] = 'Bearer YOUR_ACCESS_TOKEN' response = http.request(request) puts response.body ``` ```PHP // Example using cURL in PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/programs'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_ACCESS_TOKEN' )); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```Python # Example using requests library in Python import requests url = 'https://sandbox.api.useascend.com/v1/programs' headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### List Loans Example Source: https://useascend.readme.io/reference/listloans Example of how to list loans using the API. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/loans \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); axios.get('https://sandbox.api.useascend.com/v1/loans', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' response = HTTParty.get('https://sandbox.api.useascend.com/v1/loans', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/loans'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer YOUR_API_KEY')); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/loans" headers = { 'Authorization': 'Bearer YOUR_API_KEY' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Installments API Source: https://useascend.readme.io/reference/delete_v1-installment-plans-installment-plan-id-returns-return-id Retrieve and update installment details. Supports GET and PATCH methods for managing individual installments. ```APIDOC Installments: - GET /v1/installments/{id}: Get installment details. - PATCH /v1/installments/{id}: Update installment details. ``` -------------------------------- ### Installments API Operations Source: https://useascend.readme.io/reference/notifyinsuredinvoice Manage individual installments, including retrieval and updates. Supports GET and PATCH methods for installment management. ```APIDOC ## Installments * **Get Installment**: `GET /v1/installments/{id}` * Retrieves details of a specific installment. * **Update Installment**: `PATCH /v1/installments/{id}` * Updates an existing installment. ``` -------------------------------- ### Create User Example Source: https://useascend.readme.io/reference/createuser Demonstrates how to create a new user using the Ascend API with various programming languages. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/users \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" }' ``` ```Node const axios = require('axios'); const createUser = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/users', { firstName: 'John', lastName: 'Doe', email: 'john.doe@example.com' }, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); console.log('User created:', response.data); } catch (error) { console.error('Error creating user:', error.response.data); } }; createUser(); ``` ```Ruby require 'httparty' response = HTTParty.post('https://sandbox.api.useascend.com/v1/users', body: { firstName: 'John', lastName: 'Doe', email: 'john.doe@example.com' }.to_json, headers: { 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json' } ) puts response.body ``` ```PHP 'John', 'lastName' => 'Doe', 'email' => 'john.doe@example.com' ]); $ch = curl_init('https://sandbox.api.useascend.com/v1/users'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { echo $response; } c_close($ch); ?> ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/users" headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } payload = { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Installments API Source: https://useascend.readme.io/reference/getuser Manages individual installments, allowing retrieval and updates. Supports GET and PATCH methods for installment operations. ```APIDOC Installments: GET /v1/installments/{id} Retrieves a specific installment. Parameters: - id: The unique identifier of the installment. PATCH /v1/installments/{id} Updates an existing installment. Parameters: - id: The unique identifier of the installment. - (Request Body): Updated installment details. ``` -------------------------------- ### Ascend API: Installments Source: https://useascend.readme.io/reference/deleteinsured Retrieve and update individual installment details. Supports GET and PATCH methods for managing installment records. ```APIDOC Installments: - Get installment: GET /reference/get_v1-installments-id - Update installment: PATCH /reference/patch_v1-installments-id ``` -------------------------------- ### Steps to Create Checkout Session Source: https://useascend.readme.io/docs/lightweight-integration A step-by-step guide to creating a checkout session, involving creating an insured, a program, and billables, then using the program URL for the checkout process. ```APIDOC 1. Create Insured: POST /insured - Requires necessary insured details. - Returns `insured.id`. 2. Create Program: POST /program - Requires `insured.id` and other program details. - Parameters: - `return_url`: URL for user exit behavior. - `success_callback_url`: URL for redirect post-successful checkout. - Returns `program.id` and `program_url`. 3. Create Billable(s): POST /billable - Create one or more billables using `program_id`. - Requires `wholesaler_id` and `carrier_id` (obtained from mapping step). 4. Initiate Checkout: - Use the `program_url` obtained in step 2 as the session URL for your CTA/button. ``` -------------------------------- ### List Users Example Source: https://useascend.readme.io/reference/listusers Example of how to list users using different programming languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/users \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); axios.get('https://sandbox.api.useascend.com/v1/users', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' response = HTTParty.get('https://sandbox.api.useascend.com/v1/users', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/users'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer YOUR_API_KEY')); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/users" headers = { "Authorization": "Bearer YOUR_API_KEY" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Account Example Source: https://useascend.readme.io/reference/get_v1-accounts-id Example of how to retrieve a specific account using the API. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/accounts/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getAccount = async (accountId, accessToken) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/accounts/${accountId}`, { headers: { 'Authorization': `Bearer ${accessToken}` } }); return response.data; } catch (error) { console.error('Error fetching account:', error); throw error; } }; // Example usage: // getAccount('some-account-id', 'YOUR_ACCESS_TOKEN').then(data => console.log(data)); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/accounts/{id}' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.get(url, headers: { 'Authorization' => "Bearer #{access_token}" }) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests account_id = 'some-account-id' access_token = 'YOUR_ACCESS_TOKEN' url = f'https://sandbox.api.useascend.com/v1/accounts/{account_id}' headers = { 'Authorization': f'Bearer {access_token}' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f'Error fetching account: {e}') ``` -------------------------------- ### List Users Example Source: https://useascend.readme.io/reference/users Example of how to list users using different programming languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/users \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); axios.get('https://sandbox.api.useascend.com/v1/users', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' response = HTTParty.get('https://sandbox.api.useascend.com/v1/users', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/users'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer YOUR_API_KEY')); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/users" headers = { "Authorization": "Bearer YOUR_API_KEY" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Insured Endpoint Example Source: https://useascend.readme.io/reference/getinsured Example of how to retrieve a specific insured entity using its ID. ```APIDOC Endpoint: Get Insured Method: GET URL: https://sandbox.api.useascend.com/v1/insureds/{id} Description: Retrieves details for a specific insured entity. Parameters: - id (path parameter): The unique identifier of the insured. Authentication: - Bearer Token Example Request: GET https://sandbox.api.useascend.com/v1/insureds/123e4567-e89b-12d3-a456-426614174000 Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### Create Billable Example Source: https://useascend.readme.io/reference/createbillable Example of how to create a billable item using the UseAscend API. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/billables \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const createBillable = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/billables', {}, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error('Error creating billable:', error); } }; createBillable(); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/billables' headers = { 'Authorization' => 'Bearer YOUR_API_KEY' } response = HTTParty.post(url, headers: headers) puts response.body ``` ```PHP ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/billables' headers = { 'Authorization': 'Bearer YOUR_API_KEY' } response = requests.post(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Cancelation Return Example Source: https://useascend.readme.io/reference/getcancelationreturn Example of how to retrieve a cancelation return using the API. ```APIDOC GET https://sandbox.api.useascend.com/v1/cancelation_returns/{id} Description: Retrieves a specific cancelation return by its ID. Parameters: - id: The unique identifier for the cancelation return. Authentication: Bearer Token Response: (Details depend on the specific request and response structure, typically JSON) Supported Languages for Request: Shell, Node, Ruby, PHP, Python ``` ```Shell curl -X GET \ 'https://sandbox.api.useascend.com/v1/cancelation_returns/{id}' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const accessToken = 'YOUR_ACCESS_TOKEN'; const cancelationReturnId = '{id}'; axios.get(`https://sandbox.api.useascend.com/v1/cancelation_returns/${cancelationReturnId}`, { headers: { 'Authorization': `Bearer ${accessToken}` } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching cancelation return:', error); }); ``` ```Python import requests access_token = 'YOUR_ACCESS_TOKEN' cancelaion_return_id = '{id}' url = f'https://sandbox.api.useascend.com/v1/cancelation_returns/{cancelaion_return_id}' headers = { 'Authorization': f'Bearer {access_token}' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error: {response.status_code} - {response.text}') ``` -------------------------------- ### Get One Time Payment Example Source: https://useascend.readme.io/reference/getonetimepayment Example of how to retrieve a specific one-time payment using the API. ```APIDOC GET https://sandbox.api.useascend.com/v1/one_time_payments/{id} Language Options: Shell Node Ruby PHP Python Authentication: Bearer Token Example Request: GET https://sandbox.api.useascend.com/v1/one_time_payments/123e4567-e89b-12d3-a456-426614174000 Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### Create a Return Example Source: https://useascend.readme.io/reference/post_v1-one-time-payments-one-time-payment-id-returns Example of how to create a return for a one-time payment. This includes the HTTP method, URL, and language-specific code snippets. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/one_time_payments/{one_time_payment_id}/returns \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const oneTimePaymentId = 'YOUR_ONE_TIME_PAYMENT_ID'; const accessToken = 'YOUR_ACCESS_TOKEN'; axios.post(`https://sandbox.api.useascend.com/v1/one_time_payments/${oneTimePaymentId}/returns`, {}, { headers: { 'Authorization': `Bearer ${accessToken}` } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' one_time_payment_id = 'YOUR_ONE_TIME_PAYMENT_ID' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.post( "https://sandbox.api.useascend.com/v1/one_time_payments/#{one_time_payment_id}/returns", headers: { 'Authorization' => "Bearer #{access_token}" } ) puts response.body ``` ```PHP ``` ```Python import requests one_time_payment_id = 'YOUR_ONE_TIME_PAYMENT_ID' access_token = 'YOUR_ACCESS_TOKEN' url = f"https://sandbox.api.useascend.com/v1/one_time_payments/{one_time_payment_id}/returns" headers = { 'Authorization': f'Bearer {access_token}' } response = requests.post(url, headers=headers) print(response.json()) ``` -------------------------------- ### List Invoices Example Source: https://useascend.readme.io/reference/invoices Example of how to list invoices using various programming languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/invoices \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const listInvoices = async () => { try { const response = await axios.get('https://sandbox.api.useascend.com/v1/invoices', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error('Error listing invoices:', error); } }; listInvoices(); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/invoices' headers = { 'Authorization' => 'Bearer YOUR_API_KEY' } response = HTTParty.get(url, headers: headers) if response.success? puts response.parsed_response else puts "Error listing invoices: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/invoices' headers = { 'Authorization': 'Bearer YOUR_API_KEY' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f'Error listing invoices: {e}') ``` -------------------------------- ### List Invoices Example Source: https://useascend.readme.io/reference/listinvoices Example of how to list invoices using various programming languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/invoices \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const listInvoices = async () => { try { const response = await axios.get('https://sandbox.api.useascend.com/v1/invoices', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error('Error listing invoices:', error); } }; listInvoices(); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/invoices' headers = { 'Authorization' => 'Bearer YOUR_API_KEY' } response = HTTParty.get(url, headers: headers) if response.success? puts response.parsed_response else puts "Error listing invoices: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/invoices' headers = { 'Authorization': 'Bearer YOUR_API_KEY' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f'Error listing invoices: {e}') ``` -------------------------------- ### Get Installment by ID Source: https://useascend.readme.io/reference/installments Retrieves a specific installment using its unique identifier. Requires authentication via Bearer token. ```APIDOC GET /v1/installments/{id} Retrieves a specific installment. Parameters: - id (string, required): The unique identifier of the installment. Base URL: https://sandbox.api.useascend.com Authentication: Bearer Token Example Request: GET https://sandbox.api.useascend.com/v1/installments/installment_id_123 Response: Details of the requested installment. ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/installments/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getInstallment = async (id, token) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/installments/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); return response.data; } catch (error) { console.error('Error fetching installment:', error); throw error; } }; ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installments/' installment_id = 'your_installment_id' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.get("#{url}#{installment_id}", headers: { 'Authorization' => "Bearer #{access_token}" }) puts response.body ``` ```PHP ``` ```Python import requests installment_id = 'your_installment_id' access_token = 'YOUR_ACCESS_TOKEN' url = f"https://sandbox.api.useascend.com/v1/installments/{installment_id}" headers = { 'Authorization': f'Bearer {access_token}' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Get Installment by ID Source: https://useascend.readme.io/reference/get_v1-installments-id Retrieves a specific installment using its unique identifier. Requires authentication via Bearer token. ```APIDOC GET /v1/installments/{id} Retrieves a specific installment. Parameters: - id (string, required): The unique identifier of the installment. Base URL: https://sandbox.api.useascend.com Authentication: Bearer Token Example Request: GET https://sandbox.api.useascend.com/v1/installments/installment_id_123 Response: Details of the requested installment. ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/installments/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getInstallment = async (id, token) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/installments/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); return response.data; } catch (error) { console.error('Error fetching installment:', error); throw error; } }; ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installments/' installment_id = 'your_installment_id' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.get("#{url}#{installment_id}", headers: { 'Authorization' => "Bearer #{access_token}" }) puts response.body ``` ```PHP ``` ```Python import requests installment_id = 'your_installment_id' access_token = 'YOUR_ACCESS_TOKEN' url = f"https://sandbox.api.useascend.com/v1/installments/{installment_id}" headers = { 'Authorization': f'Bearer {access_token}' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Create Contact API Examples Source: https://useascend.readme.io/reference/post_v1-contacts Examples for creating a new contact via the UseAscend API, provided in multiple programming languages and shell. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/contacts \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "name": "John Doe", "email": "john.doe@example.com" }' ``` ```Node const axios = require('axios'); const createContact = async (apiKey, contactData) => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/contacts', contactData, { headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' } }); return response.data; } catch (error) { console.error('Error creating contact:', error); throw error; } }; // Example usage: // createContact('YOUR_API_KEY', { name: 'Jane Doe', email: 'jane.doe@example.com' }); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/contacts' api_key = 'YOUR_API_KEY' contact_data = { name: 'John Doe', email: 'john.doe@example.com' }.to_json response = HTTParty.post(url, body: contact_data, headers: { 'Authorization' => "Bearer #{api_key}", 'Content-Type' => 'application/json' } ) puts response.body ``` ```PHP 'John Doe', 'email' => 'john.doe@example.com']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $contactData); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $apiKey, 'Content-Type: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } curl_close($ch); echo $response; ?> ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/contacts' api_key = 'YOUR_API_KEY' contact_data = { 'name': 'John Doe', 'email': 'john.doe@example.com' } headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json' } response = requests.post(url, json=contact_data, headers=headers) print(response.json()) ``` -------------------------------- ### Update Program Example Source: https://useascend.readme.io/reference/updateprogram Example of how to update a program using the API, with support for multiple programming languages. ```Shell curl -X PATCH \ https://sandbox.api.useascend.com/v1/programs/{id} \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "fieldName": "newValue" }' ``` ```Node const axios = require('axios'); const updateProgram = async (programId, data) => { try { const response = await axios.patch(`https://sandbox.api.useascend.com/v1/programs/${programId}`, data, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); return response.data; } catch (error) { console.error('Error updating program:', error); throw error; } }; // Example usage: // updateProgram('some-program-id', { fieldName: 'newValue' }); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/programs/{id}' headers = { 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json' } body = { fieldName: 'newValue' }.to_json response = HTTParty.patch(url, headers: headers, body: body) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` ```PHP $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://sandbox.api.useascend.com/v1/programs/{id}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_POSTFIELDS => json_encode(['fieldName' => 'newValue']), CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json' ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/programs/{id}' headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } payload = { 'fieldName': 'newValue' } try: response = requests.patch(url, json=payload, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f'Error updating program: {e}') ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/getloan Manage installment plans, including creation, retrieval, updates, archiving, and notifications. Supports operations for getting, creating, updating, archiving, and sending reminders for installment plans. ```APIDOC InstallmentPlans: - Get installment plan: GET /v1/installment-plans/{id} - Archive installment plan: DELETE /v1/installment-plans/{id}/archive - Create installment plan: POST /v1/installment-plans - Update installment plan: PATCH /v1/installment-plans/{id} - Cancel installment plan: POST /v1/installment-plans/{id}/cancel - Notify User: POST /v1/installment-plans/{id}/reminders Returns: - Get returns: GET /v1/installment-plans/{id}/returns - Create a return: POST /v1/installment-plans/{id}/returns - Get a return: GET /v1/installment-plans/{id}/returns/{returnId} - Update a return: PATCH /v1/installment-plans/{id}/returns/{returnId} - Void return: DELETE /v1/installment-plans/{id}/returns/{returnId} ``` -------------------------------- ### List Coverage Types Example Source: https://useascend.readme.io/reference/listcoveragetypes Example of how to list coverage types using the UseAscend API. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/coverage_types \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); axios.get('https://sandbox.api.useascend.com/v1/coverage_types', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' response = HTTParty.get('https://sandbox.api.useascend.com/v1/coverage_types', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/coverage_types" headers = { 'Authorization': 'Bearer YOUR_API_KEY' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/delete_v1-installment-plans-installment-plan-id-returns-return-id Manage installment plans, including creating, updating, archiving, and handling returns. Supports various operations like GET, POST, PATCH, and DELETE for different aspects of installment plans. ```APIDOC InstallmentPlans: - GET /v1/installment-plans/{id}: Get installment plan details. - POST /v1/installment-plans: Create a new installment plan. - PATCH /v1/installment-plans: Update an existing installment plan. - POST /v1/installment-plans/{id}/archive: Archive an installment plan. - POST /v1/installment-plans/send-reminder: Notify user about installment plan. Returns: - GET /v1/installment-plans/{installment_plan_id}/returns: Get returns for an installment plan. - POST /v1/installment-plans/{installment_plan_id}/returns: Create a return for an installment plan. - GET /v1/installment-plans/{installment_plan_id}/returns/{return_id}: Get a specific return. - PATCH /v1/installment-plans/{installment_plan_id}/returns/{return_id}: Update a return. - DELETE /v1/installment-plans/{installment_plan_id}/returns/{return_id}: Void a return. ``` -------------------------------- ### List Contacts Example Source: https://useascend.readme.io/reference/get_v1-contacts Example of how to list contacts using the API, with support for multiple programming languages. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/contacts \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getContacts = async () => { try { const response = await axios.get('https://sandbox.api.useascend.com/v1/contacts', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); console.log(response.data); } catch (error) { console.error('Error fetching contacts:', error); } }; getContacts(); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/contacts' headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN' } response = HTTParty.get(url, headers: headers) puts response.body ``` ```PHP ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/contacts' headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f'Error fetching contacts: {e}') ``` -------------------------------- ### List Coverage Types Example Source: https://useascend.readme.io/reference/coveragetypes Example of how to list coverage types using the UseAscend API. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/coverage_types \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); axios.get('https://sandbox.api.useascend.com/v1/coverage_types', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` ```Ruby require 'httparty' response = HTTParty.get('https://sandbox.api.useascend.com/v1/coverage_types', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/coverage_types" headers = { 'Authorization': 'Bearer YOUR_API_KEY' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Loan Example Source: https://useascend.readme.io/reference/getloan Example of how to retrieve a loan by its ID using the Ascend API. This endpoint requires authentication via a Bearer token. ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/loans/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getLoan = async (id, accessToken) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/loans/${id}`, { headers: { 'Authorization': `Bearer ${accessToken}` } }); return response.data; } catch (error) { console.error('Error fetching loan:', error); throw error; } }; // Example usage: // getLoan('loan-id-123', 'YOUR_ACCESS_TOKEN'); ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/loans/{id}' access_token = 'YOUR_ACCESS_TOKEN' response = HTTParty.get(url, headers: { 'Authorization' => "Bearer #{access_token}" }) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` ```PHP ``` ```Python import requests def get_loan(loan_id, access_token): url = f"https://sandbox.api.useascend.com/v1/loans/{loan_id}" headers = { 'Authorization': f'Bearer {access_token}' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching loan: {e}") return None # Example usage: # loan_data = get_loan('loan-id-123', 'YOUR_ACCESS_TOKEN') # if loan_data: # print(loan_data) ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/createonetimepayment Endpoints for managing installment plans, including creation, retrieval, updates, archiving, and handling returns. Supports various operations like creating, getting, updating, and voiding returns associated with installment plans. ```APIDOC InstallmentPlans: - GET /v1/installment-plans/{id}: Retrieve a specific installment plan. - DELETE /v1/installment-plans/{id}/archive: Archive an installment plan. - POST /v1/installment-plans: Create a new installment plan. - PATCH /v1/installment-plans: Update an existing installment plan. - POST /v1/installment-plans/send-reminder: Notify a user about an installment plan. Returns: - GET /v1/installment-plans/{installment-plan-id}/returns: List returns for an installment plan. - POST /v1/installment-plans/{installment-plan-id}/returns: Create a return for an installment plan. - GET /v1/installment-plans/{installment-plan-id}/returns/{return-id}: Retrieve a specific return. - PATCH /v1/installment-plans/{installment-plan-id}/returns/{return-id}: Update a return. - DELETE /v1/installment-plans/{installment-plan-id}/returns/{return-id}: Void a return. ``` -------------------------------- ### API V1 - Installment Plans Source: https://useascend.readme.io/reference/cancelinstallmentplan Endpoints for managing installment plans, including creation, retrieval, updates, cancellations, and related return operations. ```APIDOC GET /v1/installment-plans/{id} - Retrieves a specific installment plan. DELETE /v1/installment-plans/{id}/archive - Archives an installment plan. GET /v1/installment-plans/{id}/returns - Retrieves returns associated with an installment plan. POST /v1/installment-plans/{id}/returns - Creates a new return for an installment plan. GET /v1/installment-plans/{id}/returns/{returnId} - Retrieves a specific return for an installment plan. PATCH /v1/installment-plans/{id}/returns/{returnId} - Updates a specific return for an installment plan. DELETE /v1/installment-plans/{id}/returns/{returnId} - Voids a specific return for an installment plan. POST /v1/installment-plans - Creates a new installment plan. PATCH /v1/installment-plans - Updates an existing installment plan. POST /v1/installment-plans/{id}/cancel - Cancels a purchased installment plan, voiding unpaid installments. POST /v1/installment-plans/send-reminder - Notifies a user about an installment plan. ``` -------------------------------- ### Notify User - Installment Plan Reminder Source: https://useascend.readme.io/reference/sendinstallmentplanreminder Sends a reminder notification to a user for an installment plan. This example shows how to trigger the notification via API. ```APIDOC POST /v1/installment_plans/{id}/send Description: Sends a reminder notification to the user associated with a specific installment plan. Parameters: - id (path): The unique identifier of the installment plan. Authentication: - Bearer Token Base URL: https://sandbox.api.useascend.com/v1 Example Usage: This endpoint can be called using various HTTP clients or SDKs. The response structure is not detailed here but typically indicates success or failure of the notification dispatch. ``` ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/installment_plans/{id}/send \ -H "Authorization: Bearer YOUR_API_TOKEN" ``` ```Node const axios = require('axios'); const sendReminder = async (planId, token) => { try { const response = await axios.post(`https://sandbox.api.useascend.com/v1/installment_plans/${planId}/send`, null, { headers: { 'Authorization': `Bearer ${token}` } }); console.log('Reminder sent successfully:', response.data); } catch (error) { console.error('Error sending reminder:', error.response ? error.response.data : error.message); } }; sendReminder('YOUR_PLAN_ID', 'YOUR_API_TOKEN'); ``` ```Ruby require 'httparty' url = "https://sandbox.api.useascend.com/v1/installment_plans/#{plan_id}/send" headers = { 'Authorization' => "Bearer #{api_token}" } response = HTTParty.post(url, headers: headers) if response.success? puts "Reminder sent successfully: #{response.body}" else puts "Error sending reminder: #{response.code} - #{response.body}" end ``` ```PHP $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://sandbox.api.useascend.com/v1/installment_plans/{$planId}/send", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Authorization: Bearer {$apiToken}" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:". $err; } else { echo $response; } ``` ```Python import requests url = f"https://sandbox.api.useascend.com/v1/installment_plans/{plan_id}/send" headers = { "Authorization": f"Bearer {api_token}" } try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print("Reminder sent successfully:", response.json()) except requests.exceptions.RequestException as e: print(f"Error sending reminder: {e}") ``` -------------------------------- ### Programs API Source: https://useascend.readme.io/reference/installments Manage program configurations and related actions. Includes listing, creating, retrieving, updating, archiving programs, generating payment proposals, notifying users, and estimating loan payoffs. ```APIDOC Programs: List Programs (GET): /reference/listprograms Generate payment proposal document for a program (POST): /reference/createpaymentproposal Create Program (POST): /reference/createprogram Get Program (GET): /reference/getprogram Update program (PATCH): /reference/updateprogram Archive Program (DELETE): /reference/deleteprogram Notify User (POST): /reference/notifyinsured Loan Payoff Estimate (POST): /reference/createloanpayoffestimate ``` -------------------------------- ### Create Insured API Example Source: https://useascend.readme.io/reference/createinsured Example of how to create an insured entity using the Ascend API across multiple programming languages. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/insureds \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "key": "value" }' ``` ```Node const axios = require('axios'); const createInsured = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/insureds', { // Insured data }, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); console.log(response.data); } catch (error) { console.error(error); } }; createInsured(); ``` ```Ruby require 'httparty' response = HTTParty.post('https://sandbox.api.useascend.com/v1/insureds', body: { key: 'value' }.to_json, headers: { 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json' } ) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/insureds'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['key' => 'value'])); $headers = array(); $headers[] = 'Authorization: Bearer YOUR_API_KEY'; $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $result; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/insureds" headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } data = { "key": "value" } response = requests.post(url, headers=headers, json=data) print(response.json()) ``` -------------------------------- ### List Insureds Example Source: https://useascend.readme.io/reference/listinsureds Demonstrates how to list insureds using the API. Includes example request URL, language options, and authentication method. ```APIDOC List Insureds: Method: GET URL: https://sandbox.api.useascend.com/v1/insureds Languages: - Shell - Node - Ruby - PHP - Python Credentials: - Bearer Token ``` -------------------------------- ### Premium Reducing Endorsement Example Source: https://useascend.readme.io/reference/get_v1-premium-reducing-endorsements-id Demonstrates how to retrieve a premium reducing endorsement using a GET request. Includes example URLs and language options for implementation. ```APIDOC PremiumReducingEndorsement: GET https://sandbox.api.useascend.com/v1/premium_reducing_endorsements/{id} Description: Retrieves a premium reducing endorsement by its ID. Parameters: - id: The unique identifier of the premium reducing endorsement. Headers: - Authorization: Bearer Response: - 200 OK: Returns the premium reducing endorsement details. - 404 Not Found: If the endorsement with the specified ID does not exist. Example Usage: Shell: curl -X GET \ -H "Authorization: Bearer " \ "https://sandbox.api.useascend.com/v1/premium_reducing_endorsements/{id}" Node.js: const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const endorsementId = 'YOUR_ENDORSEMENT_ID'; axios.get(`https://sandbox.api.useascend.com/v1/premium_reducing_endorsements/${endorsementId}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching endorsement:', error); }); Python: import requests api_key = 'YOUR_API_KEY' endorsement_id = 'YOUR_ENDORSEMENT_ID' url = f'https://sandbox.api.useascend.com/v1/premium_reducing_endorsements/{endorsement_id}' headers = {'Authorization': f'Bearer {api_key}'} response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error: {response.status_code} - {response.text}') ``` -------------------------------- ### API Reference - Checkout Creation Workflow Source: https://useascend.readme.io/docs Steps to create a checkout session, involving Insured, Program, and Billable resources. Each step requires identifiers from previous steps. The `program_url` is the session URL for the user interface. ```APIDOC POST /insured Description: Create an Insured entity. Requires: Insured details. Returns: An Insured object, including `insured.id`. POST /program Description: Create a Program resource, encapsulating a checkout session. Requires: `insured.id`, `return_url`, `success_callback_url`. Returns: A Program object, including `program.id` and `program_url`. Notes: - `return_url`: Determines behavior when the user exits the session. - `success_callback_url`: Redirect URL upon successful checkout. POST /billable Description: Create one or more Billable resources for a program. Requires: `program_id`, `wholesaler_id`, `carrier_id`, premium & fees. Returns: Billable object(s). ``` -------------------------------- ### Get Installment Plan Returns Source: https://useascend.readme.io/reference/get_v1-installment-plans-installment-plan-id-returns Retrieves the returns associated with a specific installment plan. This endpoint allows fetching return details using various programming languages. ```APIDOC GET /v1/installment_plans/{installment_plan_id}/returns Description: Retrieves a list of returns for a given installment plan. Parameters: - installment_plan_id (path): The unique identifier of the installment plan. Returns: A list of return objects associated with the installment plan. Base URL: https://sandbox.api.useascend.com/v1 ``` ```Shell curl -X GET \ https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```Node const axios = require('axios'); const getInstallmentPlanReturns = async (installmentPlanId, accessToken) => { try { const response = await axios.get(`https://sandbox.api.useascend.com/v1/installment_plans/${installmentPlanId}/returns`, { headers: { 'Authorization': `Bearer ${accessToken}` } }); return response.data; } catch (error) { console.error('Error fetching installment plan returns:', error); throw error; } }; ``` ```Ruby require 'httparty' url = 'https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns' headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN' } response = HTTParty.get(url, headers: headers) puts response.body ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer YOUR_ACCESS_TOKEN' )); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } c_url_close($ch); echo $response; ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Update User Example Source: https://useascend.readme.io/reference/updateuser Example of how to update a user via the API, with code samples in various languages. ```APIDOC Update User: Method: PATCH URL: https://sandbox.api.useascend.com/v1/users/{id} Description: Updates an existing user. Parameters: - id: The unique identifier of the user to update. Authentication: - Bearer Token Response: - Click 'Try It!' to see the response. Languages: - Shell - Node - Ruby - PHP - Python ``` ```Shell curl -X PATCH \ https://sandbox.api.useascend.com/v1/users/{id} \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "field": "value" }' ``` ```Node const axios = require('axios'); const updateUser = async (userId, userData) => { try { const response = await axios.patch(`https://sandbox.api.useascend.com/v1/users/${userId}`, userData, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }); return response.data; } catch (error) { console.error('Error updating user:', error); throw error; } }; ``` ```Ruby require 'httparty' url = "https://sandbox.api.useascend.com/v1/users/#{user_id}" headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type' => 'application/json' } body = { field: 'value' }.to_json response = HTTParty.patch(url, headers: headers, body: body) puts response.parsed_response ``` ```PHP $userId = 'your_user_id'; $userData = ['field' => 'value']; $token = 'YOUR_ACCESS_TOKEN'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://sandbox.api.useascend.com/v1/users/{$userId}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData)); $headers = [ "Authorization: Bearer {$token}", "Content-Type: application/json" ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests user_id = 'your_user_id' user_data = {'field': 'value'} access_token = 'YOUR_ACCESS_TOKEN' url = f"https://sandbox.api.useascend.com/v1/users/{user_id}" headers = { 'Authorization': f'Bearer {access_token}', 'Content-Type': 'application/json' } response = requests.patch(url, json=user_data, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/payouts Endpoints for managing installment plans, including creation, retrieval, updates, archiving, and notifications. Supports various operations like getting, posting, patching, and deleting. ```APIDOC InstallmentPlans: GET /v1/installment-plans/{id} - Retrieves a specific installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment-plans - Creates a new installment plan. - Parameters: - Request body containing installment plan details. PATCH /v1/installment-plans - Updates an existing installment plan. - Parameters: - Request body containing updated installment plan details. DELETE /v1/installment-plans/archive/{id} - Archives a specific installment plan. - Parameters: - id: The unique identifier of the installment plan to archive. POST /v1/installment-plans/send-reminder - Sends a reminder notification for an installment plan. - Parameters: - Request body containing reminder details. Returns: GET /v1/installment-plans/{id}/returns - Lists all returns associated with an installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment-plans/{id}/returns - Creates a new return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - Request body containing return details. GET /v1/installment-plans/{id}/returns/{return_id} - Retrieves a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. PATCH /v1/installment-plans/{id}/returns/{return_id} - Updates a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. - Request body containing updated return details. DELETE /v1/installment-plans/{id}/returns/{return_id} - Voids a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. ``` -------------------------------- ### Reference - Wholesalers Source: https://useascend.readme.io/reference/cancelinstallmentplan Endpoint for listing wholesalers. ```APIDOC GET /v1/wholesalers - Lists all wholesalers. ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/listpayouts Endpoints for managing installment plans, including creation, retrieval, updates, archiving, and notifications. Supports various operations like getting, posting, patching, and deleting. ```APIDOC InstallmentPlans: GET /v1/installment-plans/{id} - Retrieves a specific installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment-plans - Creates a new installment plan. - Parameters: - Request body containing installment plan details. PATCH /v1/installment-plans - Updates an existing installment plan. - Parameters: - Request body containing updated installment plan details. DELETE /v1/installment-plans/archive/{id} - Archives a specific installment plan. - Parameters: - id: The unique identifier of the installment plan to archive. POST /v1/installment-plans/send-reminder - Sends a reminder notification for an installment plan. - Parameters: - Request body containing reminder details. Returns: GET /v1/installment-plans/{id}/returns - Lists all returns associated with an installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment-plans/{id}/returns - Creates a new return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - Request body containing return details. GET /v1/installment-plans/{id}/returns/{return_id} - Retrieves a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. PATCH /v1/installment-plans/{id}/returns/{return_id} - Updates a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. - Request body containing updated return details. DELETE /v1/installment-plans/{id}/returns/{return_id} - Voids a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. ``` -------------------------------- ### Programs API Source: https://useascend.readme.io/reference/sendinstallmentplanreminder Manage programs within the Ascend platform. Includes listing, creating, retrieving, updating, archiving programs, and generating payment proposals and loan payoffs. ```APIDOC GET /reference/listprograms - Lists all programs. ``` ```APIDOC POST /reference/createpaymentproposal - Generates a payment proposal document for a program. ``` ```APIDOC POST /reference/createprogram - Creates a new program. ``` ```APIDOC GET /reference/getprogram - Retrieves details for a specific program. ``` ```APIDOC PATCH /reference/updateprogram - Updates an existing program. ``` ```APIDOC DELETE /reference/deleteprogram - Archives or deletes a program. ``` ```APIDOC POST /reference/notifyinsured - Notifies a user or insured party about a program. ``` ```APIDOC POST /reference/createloanpayoffestimate - Creates a loan payoff estimate for a program. ``` -------------------------------- ### Installment Plan Returns API Source: https://useascend.readme.io/reference/post_v1-installment-plans Handles returns associated with installment plans, allowing users to get, create, update, and void returns. Includes specific endpoints for managing return details. ```APIDOC InstallmentPlanReturns: - Get returns: GET /v1/installment-plans/{installmentPlanId}/returns - Create a return: POST /v1/installment-plans/{installmentPlanId}/returns - Get a return: GET /v1/installment-plans/{installmentPlanId}/returns/{returnId} - Update a return: PATCH /v1/installment-plans/{installmentPlanId}/returns/{returnId} - Void return: DELETE /v1/installment-plans/{installmentPlanId}/returns/{returnId} ``` -------------------------------- ### Cancelation Returns API Source: https://useascend.readme.io/reference/sendinstallmentplanreminder Manage cancelation and return processes. Supports listing, creating, retrieving, and updating cancelation returns. ```APIDOC GET /reference/getcancelationreturns - Lists all cancelation returns. ``` ```APIDOC POST /reference/createcancelationreturns - Creates a new cancelation return. ``` ```APIDOC GET /reference/getcancelationreturn - Retrieves a specific cancelation return. ``` ```APIDOC PATCH /reference/updatecancelationreturn - Updates an existing cancelation return. ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/post_v1-installment-plans Manages installment plans, including creation, retrieval, updates, archiving, and notifications. Supports various operations like getting, creating, updating, archiving, and sending reminders. ```APIDOC InstallmentPlans: - Get installment plan: GET /v1/installment-plans/{id} - Archive installment plan: DELETE /v1/installment-plans/{id}/archive - Create installment plan: POST /v1/installment-plans - Update installment plan: PATCH /v1/installment-plans/{id} - Cancel installment plan: POST /v1/installment-plans/{id}/cancel - Notify User: POST /v1/installment-plans/{id}/send-reminder ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/updateuser Endpoints for managing installment plans, including creation, retrieval, updates, archiving, and handling returns. Supports various operations like getting, creating, updating, voiding, and notifying users. ```APIDOC InstallmentPlans: - GET /v1/installment-plans/{id} Description: Get a specific installment plan. Related: GET /v1/installment-plans/{id}/returns, POST /v1/installment-plans - DELETE /v1/installment-plans/archive/{id} Description: Archive an installment plan. Related: GET /v1/installment-plans/{id} - GET /v1/installment-plans/{id}/returns Description: Get all returns associated with an installment plan. Related: POST /v1/installment-plans/{id}/returns, GET /v1/installment-plans/{id} - POST /v1/installment-plans/{id}/returns Description: Create a new return for an installment plan. Related: GET /v1/installment-plans/{id}/returns, GET /v1/installment-plans/{id}/returns/{returnId} - GET /v1/installment-plans/{id}/returns/{returnId} Description: Get a specific return for an installment plan. Related: POST /v1/installment-plans/{id}/returns, PATCH /v1/installment-plans/{id}/returns/{returnId} - PATCH /v1/installment-plans/{id}/returns/{returnId} Description: Update an existing return for an installment plan. Related: GET /v1/installment-plans/{id}/returns/{returnId}, DELETE /v1/installment-plans/{id}/returns/{returnId} - DELETE /v1/installment-plans/{id}/returns/{returnId} Description: Void a specific return for an installment plan. Related: PATCH /v1/installment-plans/{id}/returns/{returnId}, GET /v1/installment-plans/{id}/returns/{returnId} - POST /v1/installment-plans Description: Create a new installment plan. Related: GET /v1/installment-plans/{id} - PATCH /v1/installment-plans/{id} Description: Update an existing installment plan. Related: GET /v1/installment-plans/{id} - POST /v1/installment-plans/cancel/{id} Description: Cancel an installment plan. Related: GET /v1/installment-plans/{id} - POST /v1/installment-plans/send-reminder/{id} Description: Notify a user about an installment plan. Related: GET /v1/installment-plans/{id} ``` -------------------------------- ### Installment Plans API Source: https://useascend.readme.io/reference/sendonetimepaymentreminder Endpoints for managing installment plans, including creation, retrieval, updates, archiving, and handling returns. Supports various operations like getting, creating, updating, and voiding returns. ```APIDOC InstallmentPlans: GET /v1/installment_plans/{id} - Retrieves a specific installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment_plans - Creates a new installment plan. - Parameters: - (Request Body): Details of the installment plan to create. PATCH /v1/installment_plans - Updates an existing installment plan. - Parameters: - (Request Body): Updated details for the installment plan. DELETE /v1/installment_plans/{id}/archive - Archives a specific installment plan. - Parameters: - id: The unique identifier of the installment plan to archive. Returns: GET /v1/installment_plans/{id}/returns - Lists all returns associated with an installment plan. - Parameters: - id: The unique identifier of the installment plan. POST /v1/installment_plans/{id}/returns - Creates a new return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - (Request Body): Details of the return to create. GET /v1/installment_plans/{id}/returns/{return_id} - Retrieves a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. PATCH /v1/installment_plans/{id}/returns/{return_id} - Updates a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return. - (Request Body): Updated details for the return. DELETE /v1/installment_plans/{id}/returns/{return_id} - Voids a specific return for an installment plan. - Parameters: - id: The unique identifier of the installment plan. - return_id: The unique identifier of the return to void. POST /v1/installment_plans/{id}/cancel - Cancels an installment plan. - Parameters: - id: The unique identifier of the installment plan to cancel. POST /v1/installment_plans/send_reminder - Sends a reminder notification to a user for an installment plan. - Parameters: - (Request Body): Details for sending the reminder. ``` -------------------------------- ### Programs API Source: https://useascend.readme.io/reference/archiveinstallmentplan Endpoints for managing programs, including listing, creating, retrieving, updating, archiving, generating payment proposals, and notifying users. ```APIDOC List Programs (GET) - /reference/listprograms - Retrieves a list of programs. ``` ```APIDOC Generate payment proposal document for a program (POST) - /reference/createpaymentproposal - Generates a payment proposal document for a program. ``` ```APIDOC Create Program (POST) - /reference/createprogram - Creates a new program. ``` ```APIDOC Get Program (GET) - /reference/getprogram - Retrieves a specific program. ``` ```APIDOC Update program (PATCH) - /reference/updateprogram - Updates an existing program. ``` ```APIDOC Archive Program (DELETE) - /reference/deleteprogram - Archives a program. ``` ```APIDOC Notify User (POST) - /reference/notifyinsured - Notifies a user associated with a program. ``` ```APIDOC Loan Payoff Estimate (POST) - /reference/createloanpayoffestimate - Creates a loan payoff estimate for a program. ``` -------------------------------- ### Create Premium Reducing Endorsement Source: https://useascend.readme.io/reference/post_v1-premium-reducing-endorsements Example of how to create a premium reducing endorsement using the API. Supports multiple programming languages. ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/premium_reducing_endorsements \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "some": "data" }' ``` ```Node const axios = require('axios'); const createEndorsement = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/premium_reducing_endorsements', { some: 'data' }, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); console.log(response.data); } catch (error) { console.error('Error creating endorsement:', error); } }; createEndorsement(); ``` ```Ruby require 'httparty' response = HTTParty.post('https://sandbox.api.useascend.com/v1/premium_reducing_endorsements', body: { some: 'data' }.to_json, headers: { 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json' } ) puts response.body ``` ```PHP 'data']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ?> ``` ```Python import requests url = 'https://sandbox.api.useascend.com/v1/premium_reducing_endorsements' headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } data = { 'some': 'data' } response = requests.post(url, json=data, headers=headers) print(response.json()) ``` -------------------------------- ### Void Return Example Source: https://useascend.readme.io/reference/delete_v1-installment-plans-installment-plan-id-returns-return-id Demonstrates how to void a return for an installment plan using various programming languages. Requires authentication via Bearer token. ```Shell curl -X DELETE \ https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns/{return_id} \ -H "Authorization: Bearer YOUR_API_KEY" ``` ```Node const axios = require('axios'); const voidReturn = async (installmentPlanId, returnId, apiKey) => { try { const response = await axios.delete(`https://sandbox.api.useascend.com/v1/installment_plans/${installmentPlanId}/returns/${returnId}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }); console.log('Return voided successfully:', response.data); return response.data; } catch (error) { console.error('Error voiding return:', error.response ? error.response.data : error.message); throw error; } }; // Example usage: // voidReturn('some_plan_id', 'some_return_id', 'YOUR_API_KEY'); ``` ```Ruby require 'httparty' url = "https://sandbox.api.useascend.com/v1/installment_plans/#{installment_plan_id}/returns/#{return_id}" headers = { "Authorization": "Bearer YOUR_API_KEY" } response = HTTParty.delete(url, headers: headers) if response.success? puts "Return voided successfully: #{response.body}" else puts "Error voiding return: #{response.code} - #{response.message}" end # Example usage: # installment_plan_id = 'some_plan_id' # return_id = 'some_return_id' # void_return(installment_plan_id, return_id) ``` ```PHP ``` ```Python import requests def void_return(installment_plan_id, return_id, api_key): url = f"https://sandbox.api.useascend.com/v1/installment_plans/{installment_plan_id}/returns/{return_id}" headers = { "Authorization": f"Bearer {api_key}" } try: response = requests.delete(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(f"Return voided successfully: {response.json()}") return response.json() except requests.exceptions.RequestException as e: print(f"Error voiding return: {e}") return None # Example usage: # installment_plan_id = 'some_plan_id' # return_id = 'some_return_id' # api_key = 'YOUR_API_KEY' # void_return(installment_plan_id, return_id, api_key) ``` -------------------------------- ### Create Invoice Source: https://useascend.readme.io/reference/createinvoice Demonstrates how to create a new invoice using the Ascend API. Includes examples for various programming languages and shell. ```APIDOC POST https://sandbox.api.useascend.com/v1/invoices Description: Creates a new invoice. Base URL: https://sandbox.api.useascend.com/v1/invoices Authentication: Bearer Token Response: Click 'Try It!' to see the response. ``` ```Shell curl -X POST \ https://sandbox.api.useascend.com/v1/invoices \ -H 'Authorization: Bearer YOUR_API_KEY' ``` ```Node const axios = require('axios'); const createInvoice = async () => { try { const response = await axios.post('https://sandbox.api.useascend.com/v1/invoices', {}, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error(error); } }; createInvoice(); ``` ```Ruby require 'httparty' response = HTTParty.post('https://sandbox.api.useascend.com/v1/invoices', headers: { 'Authorization' => 'Bearer YOUR_API_KEY' }) puts response.body ``` ```PHP ``` ```Python import requests url = "https://sandbox.api.useascend.com/v1/invoices" headers = { "Authorization": "Bearer YOUR_API_KEY" } response = requests.post(url, headers=headers) print(response.json()) ``` -------------------------------- ### Update Installment Source: https://useascend.readme.io/reference/patch_v1-installments-id Updates an existing installment record. This operation requires the installment ID and allows modification of installment details. ```Shell curl -X PATCH "https://sandbox.api.useascend.com/v1/installments/{id}" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "field": "value" }' ``` ```Node const axios = require('axios'); const updateInstallment = async (id, data) => { try { const response = await axios.patch(`https://sandbox.api.useascend.com/v1/installments/${id}`, data, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }); return response.data; } catch (error) { console.error('Error updating installment:', error); throw error; } }; ``` ```Ruby require 'httparty' url = "https://sandbox.api.useascend.com/v1/installments/#{id}" headers = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type' => 'application/json' } body = { field: 'value' }.to_json response = HTTParty.patch(url, headers: headers, body: body) puts response.parsed_response ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://sandbox.api.useascend.com/v1/installments/{$id}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['field' => 'value'])); $headers = array(); $headers[] = "Authorization: Bearer YOUR_ACCESS_TOKEN"; $headers[] = "Content-Type: application/json"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $response; ``` ```Python import requests url = f"https://sandbox.api.useascend.com/v1/installments/{id}" headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } data = { 'field': 'value' } response = requests.patch(url, headers=headers, json=data) print(response.json()) ``` -------------------------------- ### Cancelation Returns API Endpoints Source: https://useascend.readme.io/reference/cancelinstallmentplan Manage cancelation and return processes, including listing, creating, retrieving, and updating cancelation returns. ```APIDOC Cancelation Returns: List Cancelation Returns (GET): /reference/getcancelationreturns - Description: Retrieves a list of cancelation returns. - Parameters: (Details not provided in source) - Returns: (Details not provided in source) Create Cancelation Return (POST): /reference/createcancelationreturns - Description: Creates a new cancelation return. - Parameters: (Details not provided in source) - Returns: (Details not provided in source) Get Cancelation Return (GET): /reference/getcancelationreturn - Description: Retrieves details of a specific cancelation return. - Parameters: (Details not provided in source) - Returns: (Details not provided in source) Update Cancelation Returns (PATCH): /reference/updatecancelationreturn - Description: Updates an existing cancelation return. - Parameters: (Details not provided in source) - Returns: (Details not provided in source) ```