Megaventory API v2017a

<back to all web services

PaymentUpdate

Inserts a new one or Updates an existing paymentUses your API Key and applies a mvRecordAction value on an mvPayment object. We can insert the mvPayment object we specified using "Insert" as our mvRecordAction. We can update a current payment using "Update". We can insert a payment if it doesn't already exist, update it if it does using "InsertOrUpdate" and we can insert new fields or update non-empty fields of the payment using "InsertOrUpdateNonEmptyFields". For inserts, CompanyId, SupplierClientId, PaymentCurrencyCode, PaymentAmount, PaymentType, PaymentInvoiceType and PaymentStatus are required. DocumentIds can be used to associate the payment with one or more invoices/bills. When updating an existing payment, PaymentId is required and the related invoices cannot be changed.

Examples:



A.

Insert a new payment for the specified invoice.

Value:

{
  "mvPayment": {
    "CompanyId": 1,
    "SupplierClientId": 5471,
    "PaymentComments": "Payment received by bank transfer",
    "PaymentAmount": 1,
    "PaymentCurrencyCode": "EUR",
    "PaymentIssueDate": "/Date(1781510705120-0000)/",
    "PaymentMethod": "NotSet",
    "PaymentType": "Payment",
    "PaymentInvoiceType": "SalesInvoice",
    "PaymentStatus": "Pending"
  },
  "mvDocumentIds": [
    48222
  ],
  "mvRecordAction": "Insert"
}


Response:

{
  "mvPayment": {
    "PaymentId": 1051,
    "CompanyId": 1,
    "SupplierClientId": 5471,
    "PaymentTransactionId": "202606151814280950",
    "PaymentComments": "Payment received by bank transfer",
    "PaymentAmount": 1,
    "PaymentCurrencyCode": "EUR",
    "PaymentIssueDate": "/Date(1781510705120-0000)/",
    "ParentPaymentId": 0,
    "PaymentApplication": "Megaventory",
    "PaymentApplicationReference": "",
    "PaymentCreatedDate": "/Date(1781510705127-0000)/",
    "PaymentUpdatedDate": "/Date(1781510705127-0000)/",
    "PaymentMethod": "NotSet",
    "PaymentType": "Payment",
    "PaymentInvoiceType": "SalesInvoice",
    "PaymentStatus": "Pending"
  },
  "ResponseStatus": {
    "ErrorCode": "0"
  },
  "entityID": 1051
}

B.



Update the comments of an existing payment.

Value:

{
  "mvPayment": {
    "PaymentId": 1051,
    "PaymentComments": "Payment received!!"
  },
  "mvRecordAction": "Update"
}


Response:

{
  "mvPayment": {
    "PaymentId": 1051,
    "CompanyId": 1,
    "SupplierClientId": 5471,
    "PaymentTransactionId": "202606151814280950",
    "PaymentComments": "Payment received and verified",
    "PaymentAmount": 1,
    "PaymentCurrencyCode": "EUR",
    "PaymentIssueDate": "/Date(1781510705120-0000)/",
    "ParentPaymentId": 0,
    "PaymentApplication": "Megaventory",
    "PaymentApplicationReference": "",
    "PaymentCreatedDate": "/Date(1781510705127-0000)/",
    "PaymentUpdatedDate": "/Date(1781510705127-0000)/",
    "PaymentMethod": "NotSet",
    "PaymentType": "Payment",
    "PaymentInvoiceType": "SalesInvoice",
    "PaymentStatus": "Pending"
  },
  "ResponseStatus": {
    "ErrorCode": "0"
  },
  "entityID": 1051
}

To override the Content-type in your clients HTTP Accept Header, append the .soap11 suffix or ?format=soap11

HTTP + SOAP11

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /soap11 HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: PaymentUpdate

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>

<PaymentUpdate xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <APIKEY>String</APIKEY>
  <mvPayment xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:PaymentId>0</d2p1:PaymentId>
    <d2p1:CompanyId>0</d2p1:CompanyId>
    <d2p1:SupplierClientId>0</d2p1:SupplierClientId>
    <d2p1:PaymentTransactionId>String</d2p1:PaymentTransactionId>
    <d2p1:PaymentComments>String</d2p1:PaymentComments>
    <d2p1:PaymentAmount>0</d2p1:PaymentAmount>
    <d2p1:PaymentCurrencyCode>STRING</d2p1:PaymentCurrencyCode>
    <d2p1:PaymentIssueDate>0001-01-01T00:00:00</d2p1:PaymentIssueDate>
    <d2p1:ParentPaymentId>0</d2p1:ParentPaymentId>
    <d2p1:PaymentApplication>Undefined</d2p1:PaymentApplication>
    <d2p1:PaymentApplicationReference>String</d2p1:PaymentApplicationReference>
    <d2p1:PaymentCreatedDate>0001-01-01T00:00:00</d2p1:PaymentCreatedDate>
    <d2p1:PaymentUpdatedDate>0001-01-01T00:00:00</d2p1:PaymentUpdatedDate>
    <d2p1:PaymentMethod>NotSet</d2p1:PaymentMethod>
    <d2p1:PaymentType>Undefined</d2p1:PaymentType>
    <d2p1:PaymentInvoiceType>Undefined</d2p1:PaymentInvoiceType>
    <d2p1:PaymentStatus>Undefined</d2p1:PaymentStatus>
  </mvPayment>
  <DocumentIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </DocumentIds>
  <mvRecordAction>Insert</mvRecordAction>
</PaymentUpdate>

    </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>

<PaymentUpdateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <mvPayment xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:PaymentId>0</d2p1:PaymentId>
    <d2p1:CompanyId>0</d2p1:CompanyId>
    <d2p1:SupplierClientId>0</d2p1:SupplierClientId>
    <d2p1:PaymentTransactionId>String</d2p1:PaymentTransactionId>
    <d2p1:PaymentComments>String</d2p1:PaymentComments>
    <d2p1:PaymentAmount>0</d2p1:PaymentAmount>
    <d2p1:PaymentCurrencyCode>STRING</d2p1:PaymentCurrencyCode>
    <d2p1:PaymentIssueDate>0001-01-01T00:00:00</d2p1:PaymentIssueDate>
    <d2p1:ParentPaymentId>0</d2p1:ParentPaymentId>
    <d2p1:PaymentApplication>Undefined</d2p1:PaymentApplication>
    <d2p1:PaymentApplicationReference>String</d2p1:PaymentApplicationReference>
    <d2p1:PaymentCreatedDate>0001-01-01T00:00:00</d2p1:PaymentCreatedDate>
    <d2p1:PaymentUpdatedDate>0001-01-01T00:00:00</d2p1:PaymentUpdatedDate>
    <d2p1:PaymentMethod>NotSet</d2p1:PaymentMethod>
    <d2p1:PaymentType>Undefined</d2p1:PaymentType>
    <d2p1:PaymentInvoiceType>Undefined</d2p1:PaymentInvoiceType>
    <d2p1:PaymentStatus>Undefined</d2p1:PaymentStatus>
  </mvPayment>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
      </d2p1:ResponseError>
    </d2p1:Errors>
  </ResponseStatus>
  <entityID>0</entityID>
  <InternalErrorCode>String</InternalErrorCode>
</PaymentUpdateResponse>

    </soap:Body>
</soap:Envelope>