AddInvoicePayment

Description

The AddInvoicePayment method adds an invoice payment to the EBizCharge Customer Portal and EBizCharge Admin Portal, which can then be synced to the ERP software. Once the invoice payment has been added, it can be retrieved by calling GetPayments.

Syntax

InvoicePaymentResponse AddInvoicePayment(SecurityToken securityToken, InvoicePaymentRequest payment)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

InvoicePaymentRequest

payment

R

List of InvoicePaymentDetails objects, each specifying which Invoice (by internal ID) the payment applies to.

Required Fields
  • CustomerId
  • RefNum
  • TotalPaidAmount
  • CustNum
  • PaymentMethodId - If the ID is unknown, send empty.
  • PaymentMethodType
  • InvoicePaymentDetails:
    • InvoiceInternalId

Return Value

TypeDescription
InvoicePaymentResponseIndicates whether the Payment was successfully added and applied to the specified Invoice.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:AddInvoicePayment>
         <ebiz:securityToken>
            <ebiz:SecurityId>**************-b899-9301*************</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:payment>
            <ebiz:CustomerId>testing-1</ebiz:CustomerId>
            <ebiz:InvoicePaymentDetails>  
              <!--Zero or more repetitions:-->
               <ebiz:InvoicePaymentDetails>
                  <ebiz:InvoiceInternalId>**************77892f-bb9b-1b4************</ebiz:InvoiceInternalId>
               </ebiz:InvoicePaymentDetails>
            </ebiz:InvoicePaymentDetails>
            <ebiz:RefNum>******4672</ebiz:RefNum>
            <ebiz:TotalPaidAmount>404</ebiz:TotalPaidAmount>
            <ebiz:CustNum>****1925</ebiz:CustNum>
            <ebiz:PaymentMethodId/>
            <ebiz:PaymentMethodType>CreditCard</ebiz:PaymentMethodType>
         </ebiz:payment>
      </ebiz:AddInvoicePayment>
   </soapenv:Body>
</soapenv:Envelope>
public void AddInvoicePayment()
{
  eBizService apiClient = new eBizService();
  SecurityToken securityToken = new SecurityToken
  {
    SecurityId = "********-90b4-4a38-ad78-********",
    UserId = "",
    Password = ""
    };
  InvoicePaymentRequest invoicePaymentRequest = new InvoicePaymentRequest();
  invoicePaymentRequest.CustomerId = "C-E&000002";
  InvoicePaymentDetails[] invoicePaymentDetails = new InvoicePaymentDetails[1];
  invoicePaymentDetails[0] = new InvoicePaymentDetails
  {
    InvoiceInternalId = "********-974a-46c6-a639-********", // Invoice iternal id taken from AddInvoice response
    PaidAmount = 100
    };
  invoicePaymentRequest.InvoicePaymentDetails = invoicePaymentDetails;
  invoicePaymentRequest.AuthCode = "375627";
  invoicePaymentRequest.RefNum = "3087041257";
  invoicePaymentRequest.TotalPaidAmount = 100; // Amount Paid
  invoicePaymentRequest.Currency = "USD";
  invoicePaymentRequest.PaymentMethodId = "";
  invoicePaymentRequest.PaymentMethodType = "CreditCard";
  invoicePaymentRequest.Software = "SOFTWARENAME";
  var invoicePaymentResponse = apiClient.AddInvoicePayment(securityToken, invoicePaymentRequest);
  Console.WriteLine(invoicePaymentResponse.Status);
  Console.WriteLine(invoicePaymentResponse.StatusCode);
  Console.WriteLine(invoicePaymentResponse.Error);
  Console.WriteLine(invoicePaymentResponse.ErrorCode);
}
function addInvoicePayment(){
  $client = new SoapClient('End point URL');
  $securityToken = array(
    'SecurityId' => '********-454757-********-777',
    'UserId' => 'merchant1',
    'Password' => 'merchant1'
  );
  $invoicePaymentDetails = array(
    'InvoiceInternalId' => '467457',
    'PaidAmount' => '200',
    'Currency' => 'USD'
  );
  $payment = array(
    'CustomerId' => 1,
    'InvoicePaymentDetails' => $invoicePaymentDetails,
    'AuthCode' => 'Tets-123',
    'RefNum' => 'po-223',
    'TotalPaidAmount' => 12,
    'Currency' => 'USD',
    'CustNum' => 'rs001',
    'PaymentMethodId' => 1,
    'PaymentMethodType' => 'CreditCard',
    'Software' => 'Woocommerce'
  );
  $addInvoicePayment = array(
    'securityToken' => $securityToken,
    'payment' => $payment,
  );
  $addInvoicePaymentResponse = $client->AddInvoicePayment($addInvoicePayment);
  $addInvoicePaymentResponseResult = $addInvoicePaymentResponse->AddInvoicePaymentResult;
}

Example Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <AddInvoicePaymentResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddInvoicePaymentResult>
            <PaymentInternalId>********-da24-4b49-8f4e-********</PaymentInternalId>
            <Status>Success</Status>
            <StatusCode>1</StatusCode>
            <Error />
            <ErrorCode>0</ErrorCode>
         </AddInvoicePaymentResult>
      </AddInvoicePaymentResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <AddInvoicePaymentResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddInvoicePaymentResult>
            <PaymentInternalId>*********53d896f95</PaymentInternalId>
            <Status>Error</Status>
            <StatusCode>0</StatusCode>
            <Error>Adding Record error The parameterized query '(@PaymentId uniqueidentifier,@MerchantId nchar(50),@UserId nchar' expects the parameter '@PaymentMethodId', which was not supplied.</Error>
            <ErrorCode>3</ErrorCode>
         </AddInvoicePaymentResult>
      </AddInvoicePaymentResponse>
   </s:Body>
</s:Envelope>