AddInvoicePayment

Add a payment to invoices when done from external app to existing eConnect invoices.

Description

This method adds external invoice payment data to EBizCharge customer portal and can be synced with the ERP software.

Syntax

InvoicePaymentResponse AddInvoicePayment(SecurityToken securityToken, InvoicePaymentRequest payment)

Arguments

TypeNameDescription
SecurityTokensecurityTokenMerchant security token: used to identify merchant and validate transaction. (required)
InvoicePaymentRequestpaymentInvoice payment details. (required)

Return Value

TypeDescription
InvoicePaymentResponseReturns result of Add Invoice Payment request.

Examples

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;
}
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>********-c3f6-42d3-a49b-********</ebiz:SecurityId>
            <ebiz:UserId>?</ebiz:UserId>
            <ebiz:Password>?</ebiz:Password>
         </ebiz:securityToken>
         <ebiz:payment>
            <ebiz:CustomerId>01-SHEPARD</ebiz:CustomerId>
            <ebiz:InvoicePaymentDetails>  
              <ebiz:InvoicePaymentDetails>
                  <ebiz:InvoiceInternalId>********-8a60-4022-be61-********</ebiz:InvoiceInternalId>
                  <ebiz:PaidAmount>404</ebiz:PaidAmount>
                  <ebiz:Currency>USD</ebiz:Currency>
               </ebiz:InvoicePaymentDetails>
            </ebiz:InvoicePaymentDetails>
            <ebiz:AuthCode>773938</ebiz:AuthCode>
            <ebiz:RefNum>2868154356</ebiz:RefNum>
            <ebiz:TotalPaidAmount>404</ebiz:TotalPaidAmount>
            <ebiz:Currency />
            <ebiz:CustNum>73904925</ebiz:CustNum>
            <ebiz:PaymentMethodId />
            <ebiz:PaymentMethodType>CreditCard</ebiz:PaymentMethodType>
            <ebiz:Software>SAGE100</ebiz:Software>
         </ebiz:payment>
      </ebiz:AddInvoicePayment>
   </soapenv:Body>
</soapenv:Envelope>

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>
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);
}