Megaventory API v2017a

<back to all web services

PaymentUpdate

The following routes are available for this service:
POST/Payment/PaymentUpdateInserts 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 .jsv suffix or ?format=jsv

HTTP + JSV

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

POST /jsv/reply/PaymentUpdate HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/jsv
Content-Length: length

{
	APIKEY: String,
	mvPayment: 
	{
		PaymentId: 0,
		CompanyId: 0,
		SupplierClientId: 0,
		PaymentTransactionId: String,
		PaymentComments: String,
		PaymentAmount: 0,
		PaymentCurrencyCode: STRING,
		PaymentIssueDate: 0001-01-01,
		ParentPaymentId: 0,
		PaymentApplication: Undefined,
		PaymentApplicationReference: String,
		PaymentCreatedDate: 0001-01-01,
		PaymentUpdatedDate: 0001-01-01,
		PaymentMethod: NotSet,
		PaymentType: Undefined,
		PaymentInvoiceType: Undefined,
		PaymentStatus: Undefined
	},
	DocumentIds: 
	[
		0
	],
	mvRecordAction: Insert
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	mvPayment: 
	{
		PaymentId: 0,
		CompanyId: 0,
		SupplierClientId: 0,
		PaymentTransactionId: String,
		PaymentComments: String,
		PaymentAmount: 0,
		PaymentCurrencyCode: STRING,
		PaymentIssueDate: 0001-01-01,
		ParentPaymentId: 0,
		PaymentApplication: Undefined,
		PaymentApplicationReference: String,
		PaymentCreatedDate: 0001-01-01,
		PaymentUpdatedDate: 0001-01-01,
		PaymentMethod: NotSet,
		PaymentType: Undefined,
		PaymentInvoiceType: Undefined,
		PaymentStatus: Undefined
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String
			}
		]
	},
	entityID: 0,
	InternalErrorCode: String
}