» Payment Module SDK Documentation
» Payment Module SDK Documentation

Overview

The Payment Module in the Exsited SDK provides a robust set of tools to handle payment-related operations within your application. It allows developers to streamline payment processing, apply payments to invoices, and retrieve detailed payment histories for auditing or reconciliation purposes. Designed for versatility, this module supports a wide range of payment processors and ensures accurate financial tracking.

Common Import Requirements

The following imports are required when working with any payment-related functions in both Python and PHP.

from exsited.exsited.exsited_sdk import ExsitedSDK
from exsited.common.ab_exception import ABException
from exsited.common.sdk_conf import SDKConfig
from config import CommonData

Creating a Basic Payment

Function: createBasicPayment()

Purpose

The function creates a payment for a specified invoice by submitting payment details, including the payment processor, amount, and reference. It also includes additional details such as the payment date and associated notes. The function validates the payment and returns the payment details upon success.

Parameters 

Parameter
Type
Description
INVOICE_ID
String
The unique identifier for the invoice associated with the payment.
PAYMENT_DATE
String (Date)
The date when the payment was made (format: YYYY-MM-DD).
PAYMENT_NOTE
String
A note or description related to the payment.
PROCESSOR
String
The processor or method of payment (e.g., "Cash", "Credit").
AMOUNT
String (Decimal)
The amount of money applied in the payment (e.g., "20.00").
REFERENCE
String
A reference or identifier for the payment transaction.

Use Case

This function can be used to process payments and apply them to invoices. It is useful when creating payments for outstanding invoices in the system, ensuring the correct amount is applied and reconciling the payment with the invoice.

def create_basic_payment():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False
    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
    try:
        payment_applied = PaymentAppliedDTO(processor="PROCESSOR", amount="AMOUNT", reference="REFERENCE")
        payment_data = PaymentDataDTO(date="PAYMENT_DATE", paymentApplied=[payment_applied], note="PAYMENT_NOTE")
        request_data = PaymentCreateDTO(payment=payment_data)
        response = exsited_sdk.payment.create(invoice_id="INVOICE_ID", request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The response contains the details of the created payment, including the payment status, ID, applied amount, payment processor, reference, and invoice details. It also includes reconciliation status, total applied, and timestamps for creation and updates. The response can be used to verify the successful application of the payment to the specified invoice.

ItemResponseDTO(
    item=ItemDataDTO(
        status='STATUS',
        id='ITEM_ID',
        name='ITEM_NAME',
        displayName='DISPLAY_NAME',
        description='DESCRIPTION',
        type='TYPE',
        baseUom='BASE_UOM',
        parentItemId=None,
        origin='ORIGIN',
        createdBy='CREATED_BY',
        createdOn='CREATED_ON',
        lastUpdatedBy='LAST_UPDATED_BY',
        lastUpdatedOn='LAST_UPDATED_ON',
        uuid='UUID',
        version='VERSION',
        imageUri='IMAGE_URI',
        group=None,
        manager=None,
        customForm=CustomFormDTO(
            name='CUSTOM_FORM_NAME',
            uuid='CUSTOM_FORM_UUID'
        ),
        customAttributes=[],
        customObjects=[],
        codes=[
            CodesDTO(name='CODE_NAME_1', value='CODE_VALUE_1'),
            CodesDTO(name='CODE_NAME_2', value='CODE_VALUE_2')
        ],
        uoms=[],
        currencies=[
            CurrenciesDTO(
                name='CURRENCY_NAME_1',
                usedForSale='USED_FOR_SALE',
                defaultForSale='DEFAULT_FOR_SALE',
                usedForPurchase='USED_FOR_PURCHASE',
                defaultForPurchase='DEFAULT_FOR_PURCHASE'
            ),
            CurrenciesDTO(
                name='CURRENCY_NAME_2',
                usedForSale='USED_FOR_SALE',
                defaultForSale='DEFAULT_FOR_SALE',
                usedForPurchase='USED_FOR_PURCHASE',
                defaultForPurchase='DEFAULT_FOR_PURCHASE'
            )
        ],
        sale=SaleDTO(
            enabled='SALE_ENABLED',
            invoiceNote='INVOICE_NOTE',
            accountingCode=AccountingCodeDTO(salesRevenue=None),
            defaultSalePrice='DEFAULT_SALE_PRICE',
            shippingProfile='SHIPPING_PROFILE',
            taxExemptWhenSold='TAX_EXEMPT_WHEN_SOLD',
            pricingMethod='PRICING_METHOD',
            taxConfiguration=SaleTaxConfigurationDTO(
                salePriceEnteredIsInclusiveOfTax='TAX_INCLUDED',
                salePriceIsBasedOn=None,
                taxCode=None
            ),
            pricingProfile=None,
            pricingSchedules=None,
            pricingLevels=[],
            charge=SaleChargeDTO(
                type='CHARGE_TYPE',
                pricePeriod=None,
                properties=[
                    SaleChargePropertiesDTO(name='PROPERTY_NAME_1', value='PROPERTY_VALUE_1'),
                    SaleChargePropertiesDTO(name='PROPERTY_NAME_2', value='PROPERTY_VALUE_2')
                ]
            ),
            paymentProperties=[
                SaleChargePropertiesDTO(name='PROPERTY_NAME_1', value='PROPERTY_VALUE_1'),
                SaleChargePropertiesDTO(name='PROPERTY_NAME_2', value='PROPERTY_VALUE_2')
            ],
            discountProfile={},
            pricing=PricingDTO(
                type='PRICING_TYPE',
                version='VERSION',
                latestUsedPricingVersion='LATEST_PRICING_VERSION',
                pricingModule=[]
            ),
            width=None,
            height=None,
            length=None,
            weight=None,
            useOnSalePrice=None,
            salePriceVariant=None,
            salePrice=None,
            startDate=None,
            endDate=None
        ),
        purchase=PurchaseDTO(
            enabled='PURCHASE_ENABLED',
            enableSupplierManagement='SUPPLIER_MANAGEMENT_ENABLED',
            accountingCode=AccountingCodeDTO(salesRevenue=None),
            purchaseOrderNote='PURCHASE_NOTE',
            defaultPurchasePrice='DEFAULT_PURCHASE_PRICE',
            taxExemptWhenPurchase='TAX_EXEMPT_WHEN_PURCHASED',
            taxConfiguration=PurchaseTaxConfigurationDTO(
                purchasePriceEnteredIsInclusiveOfTax='TAX_INCLUDED'
            ),
            pricingProfile=None,
            purchaseProperties=[
                PurchasePropertiesDTO(name='PROPERTY_NAME_1', value='PROPERTY_VALUE_1'),
                PurchasePropertiesDTO(name='PROPERTY_NAME_2', value='PROPERTY_VALUE_2')
            ],
            pricing=PricingDTO(
                type='PRICING_TYPE',
                version='VERSION',
                latestUsedPricingVersion='LATEST_PRICING_VERSION',
                pricingModule=[]
            ),
            suppliers=None
        ),
        inventories=InventoriesDTO(
            isEnabled='INVENTORY_ENABLED',
            preorderPeriod=None,
            warehouseIsEnabled='WAREHOUSE_ENABLED',
            warehouses=[
                InventoryWarehouseDTO(
                    name='WAREHOUSE_NAME',
                    uuid='WAREHOUSE_UUID',
                    link='WAREHOUSE_LINK',
                    quantityOnHand='QUANTITY_ON_HAND',
                    quantityOnHandValue='QUANTITY_ON_HAND_VALUE',
                    quantityPromised='QUANTITY_PROMISED',
                    quantityOnOrder='QUANTITY_ON_ORDER',
                    quantityOnReturn='QUANTITY_ON_RETURN',
                    quantityOnPurchaseReturn='QUANTITY_ON_PURCHASE_RETURN',
                    quantityAvailable='QUANTITY_AVAILABLE',
                    quantityAvailableValue='QUANTITY_AVAILABLE_VALUE',
                    uom='UOM'
                )
            ],
            inventoryProperties=InventoryPropertiesDTO(
                quantityAvailableForSaleDetermination=['DETERMINATION_METHOD'],
                quantityAvailableForSale='QUANTITY_AVAILABLE_FOR_SALE',
                enableLowStockNotification='ENABLE_LOW_STOCK_NOTIFICATION',
                lowStockThresholdIsBasedOn='LOW_STOCK_THRESHOLD',
                enableReordering='ENABLE_REORDERING',
                reorderingThresholdIsBasedOn='REORDERING_THRESHOLD'
            )
        ),
        kpis=KpisDTO(
            totalRevenue='TOTAL_REVENUE',
            totalCollected='TOTAL_COLLECTED',
            totalOutstanding='TOTAL_OUTSTANDING',
            totalOverdue='TOTAL_OVERDUE'
        )
    )
)

Getting Payment Details of a Specific Invoice

Function: getInvoicePaymentDetails()

Purpose

The function retrieves detailed payment information for a specified invoice. This function is useful for reviewing payment transactions, reconciling records, and ensuring the correct application of payments to the invoice.

Parameters

Parameter Type Description
INVOICE_ID String The unique identifier of the invoice for which payment details are being retrieved.

Use Case

This function can be used when detailed payment information is required for auditing, customer queries, or verifying payment records against a specific invoice. For example, it can be applied in financial systems to review applied payments and their statuses.

def get_invoice_payment_details():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.invoice_details(id='INVOICE_ID')
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns detailed information about the payments associated with the specified invoice. This includes the unique payment ID, the amount applied to the invoice, the payment processor used (e.g., card or direct debit), a reference for the transaction, and the current status of the payment, such as successful, pending, or failed.

PaymentInvoiceResponseDTO(
    invoice=PaymentListDTO(
        payments=[
            PaymentDataDTO(
                id='PAYMENT_ID_1',
                date='PAYMENT_DATE_1',
                status='PAYMENT_STATUS_1',
                reconcileStatus='RECONCILE_STATUS_1',
                totalApplied='TOTAL_APPLIED_1',
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor='PROCESSOR_1',
                        amount=AMOUNT_1,
                        reference='REFERENCE_1',
                        method='METHOD_1'
                    )
                ],
                note='NOTE_1',
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied='APPLIED_AMOUNT_1',
                        code='INVOICE_CODE_1',
                        dueDate='DUE_DATE_1',
                        issueDate='ISSUE_DATE_1',
                        outstanding='OUTSTANDING_AMOUNT_1',
                        total='TOTAL_AMOUNT_1'
                    )
                ],
                createdBy='CREATED_BY_1',
                createdOn='CREATED_ON_1',
                lastUpdatedBy='LAST_UPDATED_BY_1',
                lastUpdatedOn='LAST_UPDATED_ON_1',
                uuid='UUID_1',
                version='VERSION_1',
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            ),
            PaymentDataDTO(
                id='PAYMENT_ID_2',
                date='PAYMENT_DATE_2',
                status='PAYMENT_STATUS_2',
                reconcileStatus='RECONCILE_STATUS_2',
                totalApplied='TOTAL_APPLIED_2',
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor='PROCESSOR_2',
                        amount=AMOUNT_2,
                        reference='REFERENCE_2',
                        method='METHOD_2'
                    )
                ],
                note='NOTE_2',
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied='APPLIED_AMOUNT_2',
                        code='INVOICE_CODE_2',
                        dueDate='DUE_DATE_2',
                        issueDate='ISSUE_DATE_2',
                        outstanding='OUTSTANDING_AMOUNT_2',
                        total='TOTAL_AMOUNT_2'
                    )
                ],
                createdBy='CREATED_BY_2',
                createdOn='CREATED_ON_2',
                lastUpdatedBy='LAST_UPDATED_BY_2',
                lastUpdatedOn='LAST_UPDATED_ON_2',
                uuid='UUID_2',
                version='VERSION_2',
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            ),
            PaymentDataDTO(
                id='PAYMENT_ID_3',
                date='PAYMENT_DATE_3',
                status='PAYMENT_STATUS_3',
                reconcileStatus='RECONCILE_STATUS_3',
                totalApplied='TOTAL_APPLIED_3',
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor='PROCESSOR_3',
                        amount=AMOUNT_3,
                        reference='REFERENCE_3',
                        method='METHOD_3'
                    )
                ],
                note='NOTE_3',
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied='APPLIED_AMOUNT_3',
                        code='INVOICE_CODE_3',
                        dueDate='DUE_DATE_3',
                        issueDate='ISSUE_DATE_3',
                        outstanding='OUTSTANDING_AMOUNT_3',
                        total='TOTAL_AMOUNT_3'
                    )
                ],
                createdBy='CREATED_BY_3',
                createdOn='CREATED_ON_3',
                lastUpdatedBy='LAST_UPDATED_BY_3',
                lastUpdatedOn='LAST_UPDATED_ON_3',
                uuid='UUID_3',
                version='VERSION_3',
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            )
        ],
        pagination=PaginationDTO(
            records='TOTAL_RECORDS',
            limit='LIMIT',
            offset='OFFSET',
            previousPage='PREVIOUS_PAGE',
            nextPage='NEXT_PAGE'
        )
    )
)

Getting a List of Payments

Function: getPaymentList()

Purpose

The function retrieves a list of all recorded payments in the system. It provides a structured way to access payment history, ensuring seamless integration with financial tracking and reconciliation processes.

Parameters

This function does not require any input parameters.

Use Case

This function can be used in applications that need to monitor and manage payments. For instance, an accounting system can use this function to display all processed payments, track outstanding amounts, and generate financial reports. This helps maintain accurate payment records and enhances transaction visibility.

def get_payment_list():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.list()
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

Returns a list of payments, including details such as payment IDs, amounts, dates, methods, and statuses. In case of an error, detailed error messages and raw responses are provided.

PaymentListDTO(
    payments=[
        PaymentDataDTO(
            id="PLACEHOLDER_PAYMENT_ID_1",
            date="YYYY-MM-DDTHH:MM:SSZ",
            status="ACTIVE",
            reconcileStatus="PLACEHOLDER_RECONCILE_STATUS",
            totalApplied="PLACEHOLDER_TOTAL_APPLIED",
            paymentApplied=[
                PaymentAppliedDTO(
                    processor="PLACEHOLDER_PROCESSOR",
                    amount=PLACEHOLDER_AMOUNT,
                    reference="PLACEHOLDER_REFERENCE",
                    method="PLACEHOLDER_METHOD"
                )
            ],
            note=None,
            creditApplied=[],
            invoices=[
                InvoiceDTO(
                    applied="PLACEHOLDER_APPLIED_AMOUNT",
                    code="PLACEHOLDER_INVOICE_CODE",
                    dueDate="YYYY-MM-DDTHH:MM:SSZ",
                    issueDate="YYYY-MM-DDTHH:MM:SSZ",
                    outstanding="PLACEHOLDER_OUTSTANDING_AMOUNT",
                    total="PLACEHOLDER_TOTAL_AMOUNT"
                )
            ],
            createdBy="PLACEHOLDER_CREATED_BY",
            createdOn="YYYY-MM-DDTHH:MM:SSZ",
            lastUpdatedBy="PLACEHOLDER_LAST_UPDATED_BY",
            lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
            uuid="UUID-PLACEHOLDER-1",
            version="PLACEHOLDER_VERSION",
            customAttributes=[],
            customObjects=[],
            giftCertificateApplied=[]
        ),
        PaymentDataDTO(
            id="PLACEHOLDER_PAYMENT_ID_2",
            date="YYYY-MM-DDTHH:MM:SSZ",
            status="ACTIVE",
            reconcileStatus="PLACEHOLDER_RECONCILE_STATUS",
            totalApplied="PLACEHOLDER_TOTAL_APPLIED",
            paymentApplied=[
                PaymentAppliedDTO(
                    processor="PLACEHOLDER_PROCESSOR",
                    amount=PLACEHOLDER_AMOUNT,
                    reference="PLACEHOLDER_REFERENCE",
                    method="PLACEHOLDER_METHOD"
                )
            ],
            note=None,
            creditApplied=[],
            invoices=[
                InvoiceDTO(
                    applied="PLACEHOLDER_APPLIED_AMOUNT",
                    code="PLACEHOLDER_INVOICE_CODE",
                    dueDate="YYYY-MM-DDTHH:MM:SSZ",
                    issueDate="YYYY-MM-DDTHH:MM:SSZ",
                    outstanding="PLACEHOLDER_OUTSTANDING_AMOUNT",
                    total="PLACEHOLDER_TOTAL_AMOUNT"
                )
            ],
            createdBy="PLACEHOLDER_CREATED_BY",
            createdOn="YYYY-MM-DDTHH:MM:SSZ",
            lastUpdatedBy="PLACEHOLDER_LAST_UPDATED_BY",
            lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
            uuid="UUID-PLACEHOLDER-2",
            version="PLACEHOLDER_VERSION",
            customAttributes=[],
            customObjects=[],
            giftCertificateApplied=[]
        )
    ],
    pagination=PaginationDTO(
        records=PLACEHOLDER_RECORD_COUNT,
        limit=PLACEHOLDER_LIMIT,
        offset=PLACEHOLDER_OFFSET,
        previousPage="PLACEHOLDER_PREVIOUS_PAGE",
        nextPage="PLACEHOLDER_NEXT_PAGE"
    )
)

Getting Specific Payment Details

Function: getPaymentDetails()

Purpose

The function fetches detailed information about a specific payment based on the payment ID. It is designed to provide a complete view of the payment transaction, including key details such as transaction amounts, status, payment method, and related references.

Parameters

ParameterTypeDescription
PAYMENT_IDStringThe unique identifier for the payment whose details are being requested.

Use Case

This function can be used for auditing individual transactions, resolving payment disputes, or reviewing payment history for specific orders. It is commonly used in financial reporting, customer service inquiries, and system integrations where precise transaction data is necessary for accurate decision-making or troubleshooting.

def get_payment_details():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.details(id='PAYMENT_ID')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The response includes comprehensive details about the payment, such as the payment ID, transaction status, amounts, payment method, and timestamps. In case of an error, the response provides an error message and raw data to assist in troubleshooting.

PaymentDetailsDTO(
    payment=PaymentDataDTO(
        id="PMT-UUID-PLACEHOLDER",
        date="YYYY-MM-DDTHH:MM:SSZ",
        status="ACTIVE",
        reconcileStatus="NOT_RECONCILE",
        totalApplied="AMOUNT_PLACEHOLDER",
        paymentApplied=[
            PaymentAppliedDTO(
                processor="PROCESSOR_PLACEHOLDER",
                amount="AMOUNT_PLACEHOLDER",
                reference="REFERENCE_PLACEHOLDER",
                method="METHOD_PLACEHOLDER"
            )
        ],
        note=None,
        creditApplied=[],
        invoices=[
            InvoiceDTO(
                applied="AMOUNT_PLACEHOLDER",
                code="INV-UUID-PLACEHOLDER",
                dueDate="YYYY-MM-DDTHH:MM:SSZ",
                issueDate="YYYY-MM-DDTHH:MM:SSZ",
                outstanding="AMOUNT_PLACEHOLDER",
                total="AMOUNT_PLACEHOLDER"
            )
        ],
        createdBy="CREATOR_PLACEHOLDER",
        createdOn="YYYY-MM-DDTHH:MM:SSZ",
        lastUpdatedBy="",
        lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
        uuid="UUID-PLACEHOLDER",
        version="VERSION_PLACEHOLDER",
        customAttributes=[],
        customObjects=[],
        giftCertificateApplied=[]
    )
)

Getting a Payment List of a Specific Account

Function: getAccountPaymentDetails()

Purpose

The function provides detailed information about all payments associated with a specific account. This allows businesses to track payment history, review payment statuses, and analyze account-specific financial activities.

Parameters

ParameterTypeDescription
ACCOUNT_IDStringThe unique identifier for the account whose payment details are being retrieved.

Use Case

This function can be used for analyzing a customer's payment patterns, resolving account-related billing queries, and generating account-specific financial reports.

def get_account_payment_details():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.account_details(id='ACCOUNT_ID')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The response delivers a comprehensive list of payment transactions linked to the specified account. It includes payment IDs, amounts, statuses, payment methods, timestamps, and other metadata. In cases of errors, detailed error messages and raw response data are provided to facilitate troubleshooting.


PaymentAccountResponseDTO(
    account=PaymentListDTO(
        payments=[
            PaymentDataDTO(
                id="PAYMENT-ID-PLACEHOLDER-1",
                date="YYYY-MM-DDTHH:MM:SSZ",
                status="ACTIVE",
                reconcileStatus="NOT_RECONCILE",
                totalApplied="PLACEHOLDER-AMOUNT",
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor="PROCESSOR-NAME-PLACEHOLDER",
                        amount=PLACEHOLDER-AMOUNT,
                        reference="REFERENCE-PLACEHOLDER",
                        method="METHOD-PLACEHOLDER"
                    )
                ],
                note=None,
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied="PLACEHOLDER-AMOUNT",
                        code="INVOICE-CODE-PLACEHOLDER",
                        dueDate="YYYY-MM-DDTHH:MM:SSZ",
                        issueDate="YYYY-MM-DDTHH:MM:SSZ",
                        outstanding="PLACEHOLDER-AMOUNT",
                        total="PLACEHOLDER-AMOUNT"
                    )
                ],
                createdBy="CREATOR-NAME-PLACEHOLDER",
                createdOn="YYYY-MM-DDTHH:MM:SSZ",
                lastUpdatedBy="",
                lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
                uuid="UUID-PLACEHOLDER-1",
                version="VERSION-PLACEHOLDER",
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            ),
            PaymentDataDTO(
                id="PAYMENT-ID-PLACEHOLDER-2",
                date="YYYY-MM-DDTHH:MM:SSZ",
                status="ACTIVE",
                reconcileStatus="NOT_RECONCILE",
                totalApplied="PLACEHOLDER-AMOUNT",
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor="PROCESSOR-NAME-PLACEHOLDER",
                        amount=PLACEHOLDER-AMOUNT,
                        reference="REFERENCE-PLACEHOLDER",
                        method="METHOD-PLACEHOLDER"
                    )
                ],
                note=None,
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied="PLACEHOLDER-AMOUNT",
                        code="INVOICE-CODE-PLACEHOLDER",
                        dueDate="YYYY-MM-DDTHH:MM:SSZ",
                        issueDate="YYYY-MM-DDTHH:MM:SSZ",
                        outstanding="PLACEHOLDER-AMOUNT",
                        total="PLACEHOLDER-AMOUNT"
                    )
                ],
                createdBy="CREATOR-NAME-PLACEHOLDER",
                createdOn="YYYY-MM-DDTHH:MM:SSZ",
                lastUpdatedBy="",
                lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
                uuid="UUID-PLACEHOLDER-2",
                version="VERSION-PLACEHOLDER",
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            )
        ],
        pagination=PaginationDTO(
            records=PLACEHOLDER-RECORDS,
            limit=PLACEHOLDER-LIMIT,
            offset=PLACEHOLDER-OFFSET,
            previousPage="PLACEHOLDER-PREVIOUS-PAGE",
            nextPage="PLACEHOLDER-NEXT-PAGE"
        )
    )
)

Getting a Payment List of a Specific Order

Function: getOrderPaymentDetails()

Purpose

The function fetches detailed payment information for a specific order. This function is essential for tracking payments related to individual orders, validating transactions, and resolving order-specific payment issues. It aids in enhancing customer support and ensuring accurate financial records.

Parameters

ParameterTypeDescription
ORDER_IDStringThe unique identifier of the order for which payment details are being retrieved.

Use Case

This function can be used for businesses needing to examine payment details for specific orders. It supports use cases such as verifying successful transactions, troubleshooting failed payments, and reconciling order-level payment records. This function also enhances the ability to handle customer inquiries regarding order payments and contributes to efficient financial management.

def get_order_payment_details():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.order_details(id='ORDER_ID')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The response includes a detailed record of the payment associated with the specified order. This may encompass payment ID, amount, status, method, transaction date, and any associated metadata. Error responses provide descriptive messages and raw data for debugging and analysis.

PaymentOrderResponseDTO(
    order=PaymentListDTO(
        payments=[
            PaymentDataDTO(
                id="PAYMENT-ID-PLACEHOLDER-1",
                date="YYYY-MM-DDTHH:MM:SSZ",
                status="ACTIVE",
                reconcileStatus="NOT_RECONCILE",
                totalApplied="PLACEHOLDER-AMOUNT",
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor="PROCESSOR-NAME-PLACEHOLDER",
                        amount=PLACEHOLDER-AMOUNT,
                        reference="REFERENCE-PLACEHOLDER",
                        method="METHOD-PLACEHOLDER"
                    )
                ],
                note=None,
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied="PLACEHOLDER-AMOUNT",
                        code="INVOICE-CODE-PLACEHOLDER",
                        dueDate="YYYY-MM-DDTHH:MM:SSZ",
                        issueDate="YYYY-MM-DDTHH:MM:SSZ",
                        outstanding="PLACEHOLDER-AMOUNT",
                        total="PLACEHOLDER-AMOUNT"
                    )
                ],
                createdBy="CREATOR-NAME-PLACEHOLDER",
                createdOn="YYYY-MM-DDTHH:MM:SSZ",
                lastUpdatedBy="",
                lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
                uuid="UUID-PLACEHOLDER-1",
                version="VERSION-PLACEHOLDER",
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            ),
            PaymentDataDTO(
                id="PAYMENT-ID-PLACEHOLDER-2",
                date="YYYY-MM-DDTHH:MM:SSZ",
                status="ACTIVE",
                reconcileStatus="NOT_RECONCILE",
                totalApplied="PLACEHOLDER-AMOUNT",
                paymentApplied=[
                    PaymentAppliedDTO(
                        processor="PROCESSOR-NAME-PLACEHOLDER",
                        amount=PLACEHOLDER-AMOUNT,
                        reference="REFERENCE-PLACEHOLDER",
                        method="METHOD-PLACEHOLDER"
                    )
                ],
                note=None,
                creditApplied=[],
                invoices=[
                    InvoiceDTO(
                        applied="PLACEHOLDER-AMOUNT",
                        code="INVOICE-CODE-PLACEHOLDER",
                        dueDate="YYYY-MM-DDTHH:MM:SSZ",
                        issueDate="YYYY-MM-DDTHH:MM:SSZ",
                        outstanding="PLACEHOLDER-AMOUNT",
                        total="PLACEHOLDER-AMOUNT"
                    )
                ],
                createdBy="CREATOR-NAME-PLACEHOLDER",
                createdOn="YYYY-MM-DDTHH:MM:SSZ",
                lastUpdatedBy="",
                lastUpdatedOn="YYYY-MM-DDTHH:MM:SSZ",
                uuid="UUID-PLACEHOLDER-2",
                version="VERSION-PLACEHOLDER",
                customAttributes=[],
                customObjects=[],
                giftCertificateApplied=[]
            )
        ],
        pagination=PaginationDTO(
            records=PLACEHOLDER-RECORDS,
            limit=PLACEHOLDER-LIMIT,
            offset=PLACEHOLDER-OFFSET,
            previousPage="PLACEHOLDER-PREVIOUS-PAGE",
            nextPage="PLACEHOLDER-NEXT-PAGE"
        )
    )
)

Deleting a Specific Payment

Function: deletePayment()

Purpose

The function removes a specified payment record from the system. It is designed to facilitate the removal of outdated, incorrect, or redundant payment entries associated with an account. This ensures that the payment database remains accurate and clutter-free while maintaining data integrity.

Note: Online payments can not be deleted.

Parameters

ParameterTypeDescription
PAYMENT_IDStringThe unique identifier of the payment to be deleted.

Use Case

The function is ideal for managing payment records that are no longer needed, such as duplicate entries, records created in error, or test data. It is particularly useful for maintaining the accuracy of financial records, ensuring regulatory compliance, and preventing inconsistencies in account-related payment data.


def delete_payment():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = exsited_sdk.payment.delete(id="PAYMENT_ID")
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A confirmation of the successful deletion of the specified payment record is returned. In case of an error, detailed error messages and the raw response are provided for debugging purposes.


{
    "success": true,
    "status_code": 204
}

Configuration

Before using any of these functions, ensure that your API credentials are properly configured.

  • Python: The request token is retrieved from CommonData.get_request_token_dto().
  • PHP: Configuration is managed via ConfigManager and $this->paymentManager.

Language-Specific Features

Feature
Python Implementation
PHP Implementation
SDK Initialization
ExsitedSDK().init_sdk()
$this->paymentManager
Exception Handling
ABException handles errors and raw response
try-catch block for exceptions
Response Format
Prints response using print()
Outputs response using json_encode()
Configuration
Managed through SDKConfig
Managed via ConfigManager
Authentication Method
OAuth token via CommonData.get_request_token_dto()
API credentials via $this->paymentManager
Error Logging
Captures errors with ABException and prints raw response
Captures exceptions and prints error message
Data Parsing
JSON response parsed natively in Python
JSON encoded and displayed using PHP
Error Output
print(ab.get_errors()) and ab.raw_response
echo 'Error: ' . $e->getMessage()