api.v2.payments module

api.v2.payments.add_payment_method(contact_id=None, ach_account=None, ach_bank=None, ach_name_on=None, ach_routing=None, ach_type=None, card_cvv2=None, card_expires_mm=None, card_expires_yy=None, card_name_on=None, card_number=None, card_type=None, type=None, address=None)[source]

Add payment method for contact

Parameters:
  • contact_id (str) – Contact id
  • ach_account (str) – account id
  • ach_bank (str) – Bank name
  • ach_name_on (str) – Accountholder’s name
  • ach_routing (str) – Routing number
  • ach_type (str) – Account type
  • card_cvv2 (str) – Card CVV2
  • card_expires_mm (str) – Card expiration (month)
  • card_expires_yy (str) – Card expiration (year)
  • card_name_on (str) – Cardholder’s name
  • card_number (str) – Card number
  • card_type (str) – Card type
  • type (str) – Payment type ACH/CVV2
  • address (dict) – Address information for new payment method
Returns:

  • success (bool) – True, if all necessary information was provided. Otherwise False
  • messages (list of str) – List of human-readable error messages
  • data (dict) – result

api.v2.payments.apply_selected_payments(payment_ids=None, print_deposit_receipt=None)[source]

Apply selected payments and optionally generate deposit receipt upon successful application

Parameters:
  • payment_ids (list) – List of Payment ID objects to apply
  • print_deposit_receipt (bool) – Boolean flag to print deposit receipt on applied payments
Returns:

  • success (bool) – True if successful, False if not
  • message (str) – Human readable description of failure reasons
  • data (dict) – Dictionary containing the attachmentId of the deposit receipt, if selected to print

api.v2.payments.change_payment_method(policy_list=None, auto_payment_method_id=None, auto_pay_days_before=None, contact_id=None)[source]

Setup payment method for policies

Parameters:
  • policy_list (list of str) – Policies to update
  • auto_payment_method_id (str) – auto payment method id
  • auto_pay_days_before (int) – Payment date shift
  • contact_id (str) – contact id. Used if auto_payment_method_id is None or if payment-method owner need to be declared explicitly
Returns:

  • success (bool) – True, if all necessary information was provided. Otherwise False
  • messages (list of str) – List of human-readable error messages
  • data (dict) – result

api.v2.payments.create_payment_batch(data)[source]

Creates a PaymentBatch instance in the database.

Parameters:data (dict) –

A dictionary with batch info

{
    "id": str,                          # (optional) UUID (defaults to create)
    "title": str,
    "creator_id": str,                  # (optional) UUID (defaults to logged user)
    "created_at": str,                  # (optional) MM/DD/YYYY (defaults to now)
    "expected_entry_count": int,        # (optional)
    "expected_total_amount": str,       # (optional) Float parseable
    "capture_mode": str,                # (optional) "Policy Number" (default), "Invoice Code"
    "default_paid_amount_source": str,  # (optional) "Term Payoff", "Current Due"
}
Returns:
  • data (dict) – A dictionary containing the created batch info
    {
        "id": str,                          # UUID,
        "title": str,
        "created_at": str,                  # MM/DD/YYYY
        "creator_name": str,
        "creator_username": str,
        "expected_entry_count": int,
        "expected_total_amount": str,       # Float parseable
        "capture_mode": str,                # "Policy Number", "Invoice Code"
        "default_paid_amount_source": str,  # "Term Payoff", "Current Due"
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.create_payment_entries(entries)[source]

Creates payment entries in the database from the given serialized dataset

Parameters:entries (list of dicts) –

List containing serialized data for the entries to be created

{
    "entry_id": str,             # (optional) UUID
    "payor_id": str,             # (optional) UUID
    "batch_id": str,             # UUID
    "paid_amount": str,          # (optional)
    "check_number": str,         # (optional)
    "batch_datetime": str,       # (optional) MM/DD/YYYY (defaults to now)
    "invoice_code": str,         # (optional if policy_number is specified)
    "policy_number": str,        # (optional if invoice code is specified)
    "distribution_amount": str,  # (optional) Float parseable
    "distribution_action": str,  # (optional)
    "billing_schedule_id": str,  # (optional) UUID
}
Returns:
  • data (list of dicts) – List containing serialized data for the created entries
    {
        "entry_id": str,
        "group_id": str,
        "payor_name": str,
        "paid_amount": str,
        "payment_id": str,
        "payment_applied": bool,
        "owed_amount": str,
        "full_amount": str,
        "agent_name": str,
        "insured_name": str,
        "invoice_code": str,
        "policy_number": str,
        "distribution_amount": str,
        "distribution_action": str,
        "billing_schedule_id": str,
        "has_future_invoice": bool,
        "policy_is_canceled": bool,
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.delete_payment_batch(batch_id)[source]

Removes a PaymentBatch instance from the database.

Parameters:batch_id (str) – UUID of the target batch
Returns:
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.delete_payment_entries(entry_ids)[source]

Deletes payment entries from the database from the given entry ids

Parameters:entry_ids (list of str) – List containing the ids of the target payment entries
Returns:
  • data (list of str) – List containing the ids of the removed payment entries
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.import_payment_entries(entry_ids, bypass_duplicates_check=False)[source]

Import a collection of payment entries into the accounting system.

Parameters:
  • entry_ids (list of str) – List containing the ids of the target payment entries
  • bypass_duplicates_check (bool) – Whether to bypass duplicate check for all the entries being imported
Returns:

  • data (list of dict) – List of dict in the format

    {
        'entry_id': str,
        'payment_id': str,
        'duplicate_payment_id': str,
        'payment_applied': bool,
    }
    
  • success (bool) – True if successful, false if not

  • messages (list of dict) – List of dict representing errors respective to the index at the given entry_ids

    {
        "entry_id": str,
        "message": str
    }
    

api.v2.payments.make_payment_by_contact_and_payment_method(contact_id=None, payment_amount=None, payment_method_id=None, policy_id=None)[source]

Make payment for policy/contact with payment_method_id and payment_amount

Parameters:
  • payment_method_id (str) – Payment method id
  • payment_amount (str) – min/max/next_term
  • contact_id (srr) – Contact which policies should be paid(optional)
  • policy_id (str) – Policy that should be paid (optional)
Returns:

  • success (bool) – True, if all necessary information was provided. Otherwise False
  • messages (list of str) – List of human-readable error messages
  • data (dict) – results of payment

api.v2.payments.make_payment_by_invoice_or_policy(amount=0, payment_date='', invoice_number=None, policy_number=None)[source]

For given invoice/policy number we identify it’s respective policy and primary payment method, to then apply the respective amount on the payment_date. System uses the auto-pay payment method, but if non located it will default to the primary insureds’ first payment method. - Payments are always invoked through PaymentController().make_payment(). For vendors integrating

with external_payment_portal(), it’s assumed funds are already deducted any payment recorded would have similar effects as a “Cash” (but instead of payment type cash, shows as respective payment vendor).
Parameters:
  • amount (amount payment was recoded as.) –
  • payment_date (str date in format ‘YYYY-MM-dd’ representing when payment was made.) –
  • policy_number ((optional) Policy.policy_number for account we want mark payment as NSF. System) – defaults to latest term if passed instead of invoice_number.
  • invoice_number (AccountHistory.id for invoice for respective policy term payment) – was made against.
  • policy_number – defaults to latest term if passed instead of invoice_number.
Returns:

  • success (True if payment processed correctly, otherwise false)

  • messages (list of failure messages) – ::
    [

    ‘Attempted to setup default payment method’, ‘Updated account balance’ # present if success payment was processed’

    ]

  • data (dict) – ::
    {

    ‘isDuplicate’: false, ‘payoffAmount’: <decimal>, # overall amount due to payoff policy term ‘confirmationNumber’: “124312312”, # numeric string value that can be used to nsf payment later

    }

api.v2.payments.mark_payment_nsf(amount=0, payment_date='', policy_number='', invoice_number=None, confirmation_number=None)[source]

Searches respective payment for the specified amount/date/invoice and mark it as NSF. This also invokes any NSF policy activity that might happen when applying it from the UI.

Parameters:
  • amount (amount payment was recoded as.) –
  • payment_date (str date in format ‘YYYY-MM-dd’ representing when payment was made.) –
  • policy_number (Policy.policy_number for account we want mark payment as NSF. System) – defaults to latest term if passed instead of invoice_number.
  • invoice_number (AccountHistory.id for invoice for respective policy term payment) – was made against.
  • confirmation_number (unique numeric value associated with Payment record. This is) – typically returned by make_payment_by_invoice_or_policy()
Returns:

  • success (True if processed correctly, else False)

  • messages (list of strings with failure messages if success is ever False) – ::
    [

    ‘Non pay evaluation complete.’, ‘neither the invoice_number or policy_number passed can be located’

    ]

api.v2.payments.remove_payment_method(payment_method_id=None)[source]

Setup payment method for policies

Parameters:payment_method_id (str) – Payment method id to remove
Returns:
  • success (bool) – True, if all necessary information was provided. Otherwise False
  • messages (list of str) – List of human-readable error messages
api.v2.payments.retrieve_account_payoff_amount(policy_number='')[source]

For a given account (policy) number we determine what’s the payoff amount for it’s respective active term.

Parameters:policy_number (str policy.policy_number) –
Returns:
  • success (bool # true if payoff amount identified, else false)
  • messages ([) – ‘policy number <policy_number> is not recognized’, # if we can’t identify the account ]
  • data (dict) – ::
    {
    # does not show up if success = False ‘payoffAmount’: <decimal> # overall amount due to payoff policy term

    }

api.v2.payments.retrieve_convenience_fee(payment_amount=None, account_type=None)[source]

Retrieve the convenience fee to be charged by the enabled payment processor based on the amount of the payment and the type of account being used.

Parameters:
  • payment_amount (decimal) – Amount of the payment being made
  • account_type (str) – The type of the account being charged. Available options: ACH, MasterCard, VISA, AmericanExpress, Discover
Returns:

  • success (bool) – True, if all necessary information was provided. Otherwise False

  • messages (list of str) – List of human-readable error messages

  • data (dict) – Returned fee amount in the form:

    {
        "fee_amount": decimal
    }
    

api.v2.payments.retrieve_payment(payment_id=None)[source]

Retrieve the specified payment

Parameters:payment_id (str) – Requested payment id
Returns:
  • success (bool) – True, if specified payment was found, False if otherwise (or errors)
  • messages (list of str) – List of human-readable error messages
  • data (dict) – the requested payment object, having the form
    {
        'account_name': str or null,
        'authorization_state': str,
        'check_number': int,
        'comm_pay_id': UUID,
        'commission_payment': bool,
        'committer': str,
        'complete': bool,
        'confirmation_number': str,
        'date_updated': datetime,
        'deleted': bool,
        'distribution': str or null,  # a JSON-encoded dict of how payment was applied to policies
        'entry_date_time': datetime,
        'file_ids': list of UUID,
        'id': UUID,
        'invoice_number': str,
        'is_auto_payment': bool,
        'masked_number': str,
        'nsf': bool,
        'payment_instrument': str,
        'payment_interface': str or null,
        'payment_method_id': UUID,
        'payor_id': UUID,
        'printed_to_deposit': bool,
        'remote_ip': str,
        'selected_on_deposit': bool,
        'sweep': bool,
        'transaction_amount': float,
        'transaction_date_time': datetime,
        'transaction_type': str,
        'vendor_message': str,
        'vendor_stage': str or null,
        'vendor_stage_success': bool
    }
    
api.v2.payments.retrieve_payment_batch_entries(batch_id=None)[source]

Retrieves the entries related to the given batch

Parameters:batch_id (str) – UUID of the target batch
Returns:
  • data (list of dicts) – List containing serialized data for the created entries
    {
        "entry_id": str,
        "group_id": str,
        "payor_name": str,
        "paid_amount": str,
        "payment_id": str,
        "payment_applied": bool,
        "owed_amount": str,
        "full_amount": str,
        "agent_name": str,
        "insured_name": str,
        "invoice_code": str,
        "policy_number": str,
        "distribution_amount": str,
        "distribution_action": str,
        "billing_schedule_id": str,
        "has_future_invoice": bool,
        "policy_is_canceled": bool,
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.retrieve_payment_batches(load_entries=True)[source]

Retrives all PaymentBatch instances in the database.

Parameters:load_entries (bool) – Whether to load and serialize batch related entries in the response.
Returns:
  • data (list of dicts) – A list of dictionaries containing all of the existing batches
    {
        "id": str,
        "title": str,
        "created_at": str,
        "creator_name": str,
        "creator_username": str,
        "expected_entry_count": int,
        "expected_total_amount": decimal,
        "capture_mode": str,
        "default_paid_amount_source": str,
        "entries": [{
            "entry_id": str,
            "payor_name": str,
            "paid_amount": str,
            "payment_id": str,
            "payment_applied": bool,
            "policies": [{
                "policy_number": str,
                "owed_amount": str,
                "full_amount": str,
                "agent_name": str,
                "insured_name": str,
                "policy_is_canceled": bool,
                "distribution_amount": str,
                "distribution_action": str,
                "billing_schedule_id": str,
                "billing_threshold": str,
                "has_future_invoice": bool,
            }],
            "invoices": [{
                "invoice_code": str,
                "policy_number": str,
                "owed_amount": str,
                "full_amount": str,
                "agent_name": str,
                "insured_name": str,
                "policy_is_canceled": bool,
                "distribution_amount": str,
                "distribution_action": str,
                "billing_schedule_id": str,
                "billing_threshold": str,
                "has_future_invoice": bool,
            }]
        }]
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.retrieve_payment_entries(entry_ids)[source]

Retrieves the entries related to the given batch

Parameters:entry_ids (list of str) – List containing the UUID’s for the target entries
Returns:
  • data (list of dicts) – List containing serialized data for the created entries
    {
        "entry_id": str,
        "group_id": str,
        "payor_name": str,
        "paid_amount": str,
        "payment_id": str,
        "payment_applied": bool,
        "owed_amount": str,
        "full_amount": str,
        "agent_name": str,
        "insured_name": str,
        "invoice_code": str,
        "policy_number": str,
        "distribution_amount": str,
        "distribution_action": str,
        "billing_schedule_id": str,
        "has_future_invoice": bool,
        "policy_is_canceled": bool,
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.payments.retrieve_payment_methods(exp_less_than=None, contact_ids=None)[source]

Retrieves payment methods according to received parameters

Parameters:
  • exp_less_than (int) – Filter all payment methods where expiration date less than or equal (current date + exp_less_than days)
  • contact_ids (list) – Filter payments method only for listed ids
Returns:

  • data (list of dicts) – List containing payment methods
  • success (bool) – True if successful, false if not

api.v2.payments.retrieve_policy_billing_information(policy_id=None)[source]
api.v2.payments.retrieve_updated_invoice_balance(invoice_id='')[source]

For a given invoice_id we check if an associated invoice record exists If it exists we return the total amount due.

Parameters:invoice_id (AccountHistory.id where AccountHistory.transaction_type == ‘invoice’) –
Returns:
  • success (bool)
  • messages ([) – # returned if we located an AccountHistory record that is not an invoice ‘passed id is not recognized as invoice record’, # returned if we didn’t identify an AccountHistory record for passed value ‘invoice record not found’]
  • data (dict) – ::
    {
    # only returned if success == True, else empty ‘totalAmountDue’: , # 0 if already paid in full, otherwise returns remaining balance

    }

api.v2.payments.update_payment_batch(batch_id, data)[source]

Updates a PaymentBatch instance in the database.

Parameters:
  • batch_id (str) – UUID of the target batch
  • data (dict) –

    A dictionary with batch info

    {
        "title": str,
        "creator_id": str,                  # (optional) UUID (defaults to logged user)
        "created_at": str,                  # (optional) MM/DD/YYYY (defaults to now)
        "expected_entry_count": int,        # (optional)
        "expected_total_amount": str,       # (optional) Float parseable
        "capture_mode": str,                # (optional) "Policy Number" (default), "Invoice Code"
        "default_paid_amount_source": str,  # (optional) "Term Payoff", "Current Due"
    }
    
Returns:

  • data (dict) – A dictionary containing the created batch info

    {
        "id": str,                          # UUID,
        "title": str,
        "created_at": str,                  # MM/DD/YYYY
        "creator_name": str,
        "creator_username": str,
        "expected_entry_count": int,
        "expected_total_amount": str,       # Float parseable
        "capture_mode": str,                # "Policy Number", "Invoice Code"
        "default_paid_amount_source": str,  # "Term Payoff", "Current Due"
    }
    
  • success (bool) – True if successful, false if not

  • messages (list of str) – List of human-readable error messages

api.v2.payments.update_payment_entries(entries)[source]

Updates payment entries in the database from the given serialized dataset

Parameters:entries (list of dicts) –

List containing serialized data for the entries to be created

{
    "entry_id": str,             # UUID
    "payor_id": str,             # (optional) UUID
    "paid_amount": str,          # (optional)
    "check_number": str,         # (optional)
    "batch_datetime": str,       # (optional) MM/DD/YYYY (defaults to now)
    "invoice_code": str,         # (optional if policy_number is specified)
    "policy_number": str,        # (optional if invoice code is specified)
    "distribution_amount": str,  # (optional) Float parseable
    "distribution_action": str,  # (optional)
    "billing_schedule_id": str,  # (optional) UUID
}
Returns:
  • data (list of dicts) – List containing serialized data for the updated entries
    {
        "entry_id": str,
        "group_id": str,
        "payor_name": str,
        "paid_amount": str,
        "payment_id": str,
        "payment_applied": bool,
        "owed_amount": str,
        "full_amount": str,
        "agent_name": str,
        "insured_name": str,
        "invoice_code": str,
        "policy_number": str,
        "distribution_amount": str,
        "distribution_action": str,
        "billing_schedule_id": str,
        "has_future_invoice": bool,
        "policy_is_canceled": bool,
    }
    
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages