Private Sub SBDeposits()

    Dim oDep As CDeposit
    Set oDep = New CDeposit
    oDep.Init FE_Application.SessionContext
    With oDep
        .Fields(DEPOSITS_fld_DESCRIPTION) = "VBA/API Test Deposit"
        .Fields(DEPOSITS_fld_DEPOSITDATE) = "08/20/2009"
        .Fields(DEPOSITS_fld_SYSTEMOFORIGIN) = "Student Billing"
    End With
    Dim lID As Long
    lID = oDep.Fields(DEPOSITS_fld_CRDEPOSITSID)

    Debug.Print oDep.Fields(DEPOSITS_fld_DEPOSITNUMBER)
    Set oDep = Nothing
    Add_SBPayment (lID)

End Sub

Private Sub Add_SBPayment(lID As Long)
  Dim lDepositID As Long
  Dim lEa7RecordsID As Long
  Dim sSource As String
  Dim sComment As String
  Dim lReceiptStatus As Long
  Dim lReceiptAddressID As Long
  Dim cAmount As Currency
  Dim cAmountBills As Currency
  Dim cAmountCoins As Currency
 lDepositID = lID
 lEa7RecordsID = 5
 sSource = "Mail"
 sComment = "Test Payment"
 lReceiptStatus = staticentry_ReceiptStatus_NotYetPrinted
 lReceiptAddressID = 11
 cAmount = 50
 cAmountBills = 50
 cAmountCoins = 0
    Dim oPaymentHeader As CPaymentHeader
    Set oPaymentHeader = New CPaymentHeader
    With oPaymentHeader
        .Init FE_Application.SessionContext
        .Fields(PAYMENTHEADERS_fld_CRDEPOSITSID) = lDepositID
        .Fields(PAYMENTHEADERS_fld_EA7RECORDSID) = lEa7RecordsID
        .Fields(PAYMENTHEADERS_fld_SOURCE) = sSource
        .Fields(PAYMENTHEADERS_fld_COMMENT) = sComment
        .StaticEntryField(PAYMENTHEADERS_fld_RECEIPTSTATUS) = lReceiptStatus
        .Fields(PAYMENTHEADERS_fld_RECEIPTADDRESSID) = lReceiptAddressID
        With .PaymentComponents.Add
            .StaticEntryField(PAYMENTS_fld_PAYMENTTYPE) = staticentry_PaymentType_SBPayment
            .Fields(PAYMENTS_fld_AMOUNT) = cAmount
        End With
        .Fields(PAYMENTHEADERS_fld_AMOUNT) = cAmount
        .StaticEntryField(PAYMENTHEADERS_fld_PAYMENTMETHOD) = staticentry_PaymentMethods_Cash
        .Fields(PAYMENTHEADERS_fld_AMOUNTBILLS) = cAmountBills
        .Fields(PAYMENTHEADERS_fld_AMOUNTCOINS) = cAmountCoins
    End With
    Set oPaymentHeader = Nothing
End Sub