Invoice Management

Index

Invoice management resources:

Credit card, internet banking and credit payments:

List of all invoices

There are 3 types invoices: invoice, proforma and payed-by-credit. Only the type invoice is a real commercial invoice (in terms of taxation and accounting), the other types are only informative.

Some services (i.e.: Setup fee) don't have startTime and endTime, so you can see null in these fields.

Available parameters:

Example of usage: add ?page=1&pagesize=20 to the end of the address. Default page size is unlimited.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/invoice HTTP/1.1

Accept: application/json

Response 200

{
  "items": [
    {
      "id": 20000,
      "type": "invoice",
      "number": "201008662",
      "variable": "201010029",
      "createTime": 1279951821,
      "dateOfPerformance": 1279951821,
      "dueDate": 1280556621,
      "price": 13.28,
      "priceWithVat": 15.94,
      "vatPercent": 20,
      "currency": "eur",
      "items": [
        {
          "serviceName": "domain",
          "name": "websupport.sk",
          "price": 13.28,
          "priceWithVat": 15.94,
          "startTime": 1279749600,
          "endTime": 1311306526
        },
        {
          "serviceName": "thehosting",
          "name": "hostingname_1",
          "price": 10,
          "priceWithVat": 12,
          "startTime": 1279749600,
          "endTime": 1311306526
        }
      ],
      "billing": {
        "name": "Company s.r.o.",
        "city": "Lorem Ipsum",
        "street": "Dolor sit 128",
        "zip": "12345",
        "country": "sk",
        "companyRegId": "",
        "taxId": "",
        "vatId": ""
      },
      "market": {
        "name": "Slovensko",
        "identifier": "sk"
      }
    },
    {
      "id": 30000,
      "type": "invoice",
      "number": "201114081",
      "variable": "201116129",
      "createTime": 1309080824,
      "price": 12.3,
      "priceWithVat": 14.76,
      "vatPercent": 20,
      "currency": "eur",
      "items": [
        {
          "serviceName": "domain",
          "name": "websupport.sk",
          "price": 12.3,
          "priceWithVat": 14.76,
          "startTime": 1311199200,
          "endTime": 1342756126
        }
      ],
      "billing": {
        "name": "Company s.r.o.",
        "city": "Lorem Ipsum",
        "street": "Dolor sit 128",
        "zip": "12345",
        "country": "sk",
        "companyRegId": "",
        "taxId": "",
        "vatId": ""
      },
      "market": {
        "name": "Slovensko",
        "identifier": "sk"
      }
    }
  ],
  "pager": {
    "page": 1,
    "pagesize": null,
    "items": 2
  }
}

Response 404 (not found)

{
    "message": "User not found.",
    "code": 404
}

Get an invoice detail

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:id" -v -u key:secret

*if you don't know invoice id, you can also get unpaid invoices by order id on url /v1/user/:userId/invoice/by-order/:orderId

Request

GET https://rest.websupport.sk/v1/user/:userId/invoice/:id HTTP/1.1

Accept: application/json

Response 200

{
  "id": 20000,
  "type": "invoice",
  "number": "201008662",
  "variable": "201010029",
  "createTime": 1279951821,
  "price": 13.28,
  "priceWithVat": 15.94,
  "vatPercent": 20,
  "currency": "eur",
  "items": [
    {
      "serviceName": "domain",
      "name": "websupport.sk",
      "price": 13.28,
      "priceWithVat": 15.94,
      "startTime": 1279749600,
      "endTime": 1311306526
    },
    {
      "serviceName": "thehosting",
      "name": "hostingname_1",
      "price": 10,
      "priceWithVat": 12,
      "startTime": 1279749600,
      "endTime": 1311306526
    }
  ],
  "billing": {
    "name": "Company s.r.o.",
    "city": "Lorem Ipsum",
    "street": "Dolor sit 128",
    "zip": "12345",
    "country": "sk",
    "companyRegId": "",
    "taxId": "",
    "vatId": ""
  },
  "market": {
    "name": "Slovensko",
    "identifier": "sk"
  }
}

Get an invoice PDF

Returns base64 encoded PDF file.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:id/pdf" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/invoice/:id/pdf HTTP/1.1

Accept: application/json

Response 200

{
  "id": "25000",
  "pdf": "JVBERi0xLjQKJb...." // very long line (base64 encoded pdf)
}

Get an invoice PDF as RAW data

Returns a PDF file as binary data, not JSON! Headers are modified too.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:id/raw-pdf" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/invoice/:id/raw-pdf HTTP/1.1

Response 200

Binary data

Pay it

You can pay your invoice with credit card or using internet banking. At this moment we support TatraPay, VUB ePayments internet banking ComfortPay recurring payment system and Visa or MasterCard credit cards.

Add ?mobile=1 at the end of each url, if you want mobile version of internet banking / credit card payment page.

Note: if you choose ComfortPay payment system, we will store your payment card so you can use it next time through pay with a stored card method. If you don't want to store your payment card, please use CardPay system (tbcardpay).

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay" -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay HTTP/1.1

Accept: application/json

Response 200

{
    "tbtatrapay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/tatrapay",
    "tbcardpay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/creditCard-0",
    "vubeplatby": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/vubeplatby",
    "comfortpay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/creditCard-0"
}

Response 404 (invoice not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Invoice not found."
}

Pay with a stored card

You can pay your invoice with payment card that you have assigned to your account in the past. List of available payment cards for logged user can be fetched with /v1/user/:userId/paymentcard api method.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay/byPaymentCard/:paymentCardId" -u key:secret -X PUT

Request

PUT https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay/byPaymentCard/:paymentCardId HTTP/1.1

Accept: application/json

Response 200

{
    "status": true
}

Response 404 (invoice not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Invoice not found."
}

Pay with credit

Curl

curl "https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay/byCredit" -u key:secret -X PUT

Request

PUT https://rest.websupport.sk/v1/user/:userId/invoice/:invoiceId/pay/byCredit HTTP/1.1

Accept: application/json

Response 200

{
    "status": true
}

Response 404 (invoice not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Invoice not found."
}

List of all payment cards, detail, add new card ...

Go to order section for more info.

raw