# Marketplace Transaction API

## **Transaction request**

This function enables the request of Marketplace transaction details.

Url: <https://app.webshippy.com/wspyapi/getMarketplaceTransactions/{contentType}>

| Filtering terms   | Description                                                                                                                                                                                                   |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invoiceStatus`   | <p></p><p>Status of the invoice (if the given transaction has an invoice attached), possible values:</p><ul><li><code>invoiced</code>,</li><li><code>uninvoiced</code>,</li><li><code>error</code>.</li></ul> |
| `dateFrom`        | Date the transaction was created, same day or newer.                                                                                                                                                          |
| `dateTo`          | Date the transaction was created, same day or older.                                                                                                                                                          |
| `transactionRole` | <p>Role in the transaction, possible values:</p><ul><li><code>supplier</code>,</li><li><code>reatiler</code>.</li></ul>                                                                                       |

The filtering terms given in the table are in an `AND` relationship with one another, only the filtering terms to be filtered for need to be specified.

In case of **XML**:

Request (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<request>
	<apiKey>your-api-key</apiKey>
	<filters>
		<invoiceStatus>invoiced</invoiceStatus>
		<dateFrom>2021-04-21</dateFrom>
		<dateTo>2022-01-12</dateTo>
		<transactionRole>supplier</transactionRole>
	</filters>
</request>
```

Response (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>success</status>
	<result>
		<transactionId>DSPY1000134</transactionId>
		<date>2021-02-14 13:09:11</date>
		<paymentStatus>paid</paymentStatus>
		<transferredAt>2021-06-12 14:12:00</transferredAt>
		<parties>
			<supplier>
				<name>Webshippy</name>
			</supplier>
			<retailer>
				<name>Koala Adventures Teszt Bt.</name>
				<address>7621 Hungary Pécs Asd street</address>
				<email>retail@now.com</email>
				<billingTaxNumber>000000000000-99</billingTaxNumber>
			</retailer>
		</parties>
		<payment>
			<paymentId>500864504</paymentId>
		</payment>
		<products>
			<name>Premium Quality Shirt</name>
			<sku>ws2_dspy_rules_11</sku>
			<barcode>ws2_dspy_rules_11-b</barcode>
			<quantity>2</quantity>
			<transactionAmountNet>3800</transactionAmountNet>
			<vat>0</vat>
			<vatSum>0</vatSum>
			<transactionAmountGross>3800</transactionAmountGross>
			<currency>HUF</currency>
		</products>
		<invoice>
			<url>http://webshippy.lh/dropshippy/getTransactionInvoice/1000134</url>
			<status>invoiced</status>
			<serialNumber>Invoice-12345-1-54365</serialNumber>
		</invoice>
	</result>
</response>
```

In case of a failed request (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>error</status>
	<notagname>Invalid API key</notagname>
</response>
```

In case of **JSON**:

Request (example):

```
{
  "apiKey": "your-api-key",
  "filters": {
    "invoiceStatus": "invoiced",
    "dateFrom": "2021-04-21",
    "dateTo": "2022-01-12",
    "transactionRole": "supplier"
  }
}
```

Response (example):

```
{
  "status": "success",
  "result": [
    {
      "transactionId": "DSPY1000134",
      "date": "2021-02-14 13:09:11",
      "paymentStatus": "paid",
      "transferredAt": "2021-06-12 14:12:00",
      "parties": {
        "supplier": {
          "name": "Webshippy"
        },
        "retailer": {
          "name": "Koala Adventures Teszt Bt.",
          "address": "7621 Hungary Pécs Asd street",
          "email": "retail@now.com",
          "billingTaxNumber": "000000000000-99"
        }
      },
      "payment": {
        "paymentId": 500864504
      },
      "products": [
        {
          "name": "Premium Quality Shirt",
          "sku": "ws2_dspy_rules_11",
          "barcode": "ws2_dspy_rules_11-b",
          "quantity": 2,
          "transactionAmountNet": 3800,
          "vat": 0,
          "vatSum": 0,
          "transactionAmountGross": 3800,
          "currency": "HUF"
        }
      ],
      "invoice": {
        "url": "http://webshippy.lh/dropshippy/getTransactionInvoice/1000134",
        "status": "invoiced",
        "serialNumber": "Invoice-12345-1-54365"
      }
    }
  ]
}
```

In case of a failed request (example):

```
{
  "status": "error",
  "message": [
    "Invalid API key"
  ]
}
```

### Upload of invoice issued

This function enables the Marketplace suppliers to upload the invoice related to a specific transaction. A single api call allows invoice upload for multiple transactions simultaneously, but only one invoice per transaction is supported. The invoice upload is in base64 format. If there's no invoice associated with a specific transaction ID, the API will create one.

Url: <https://app.webshippy.com/wspyapi/uploadMarketplaceTransactionInvoice/{contentType}>

<table><thead><tr><th>Field</th><th width="164.33333333333331">Required?</th><th>Description</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td>Yes</td><td>The API key.</td></tr><tr><td><code>transactionId</code></td><td>Yes</td><td>The transaction ID.</td></tr><tr><td><code>invoiceSerialNumber</code></td><td>Yes</td><td>The serial number of the invoice (name of the file).</td></tr><tr><td><code>fileInput</code></td><td>Yes</td><td>The invoice in base64 format.</td></tr></tbody></table>

In case of **XML**:

Request (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<request>
	<apiKey>your-api-key</apiKey>
	<invoice>
		<transactionId>DSPY1000134</transactionId>
		<invoiceSerialNumber>Invoice-12345-1-54365</invoiceSerialNumber>
		<fileInput>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==</fileInput>
	</invoice>
</request>
```

Response (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>success</status>
	<result>
		<transactionId>DSPY1000134</transactionId>
		<invoiceSerialNumber>Invoice-12345-1-54365</invoiceSerialNumber>
		<fileInput>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==</fileInput>
	</result>
</response>
```

In case of a failed request (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<response>
	<status>error</status>
	<result>
		<transactionId>DSPY1000134</transactionId>
		<invoiceSerialNumber>Invoice-12345-1-54365</invoiceSerialNumber>
		<fileInput>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==</fileInput>
	</result>
	<message>Invoice [invoiceSerialNumber] upload failed, due to: [error]</message>
</response>
```

In case of **JSON**:

Request (example):

```
{
  "apiKey": "your-api-key",
  "invoice": [
    {
      "transactionId": "DSPY1000134",
      "invoiceSerialNumber": "Invoice-12345-1-54365",
      "fileInput": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
    }
  ]
}
```

Response (example):

```
{
  "status": "success",
  "result": [
    {
      "transactionId": "DSPY1000134",
      "invoiceSerialNumber": "Invoice-12345-1-54365",
      "fileInput": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
    }
  ]
}
```

In case of a failed request (example):

```
{
  "status": "error",
  "result": [
    {
      "transactionId": "DSPY1000134",
      "invoiceSerialNumber": "Invoice-12345-1-54365",
      "fileInput": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
    }
  ],
  "message": [
    "Invoice [invoiceSerialNumber] upload failed, due to: [error]"
  ]
}
```

**Additional response options** in case of failed request:

* `"[field:example] Example field has to be integer"`
* `"Invalid API key"`
* `"Entity not found"`
* `"Already existing entity"`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.apidoc-en.webshippy.com/webshippy-api-guide/marketplace-transaction-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
