Chilkat Online Tools

lianja / easybill REST API / Fetch SEPA payment

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loHttp = createobject("CkHttp")

loHttp.SetRequestHeader("Authorization","{{apiKey}}")
loHttp.SetRequestHeader("Accept","application/json")

loSbResponseBody = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://api.easybill.de/rest/v1/sepa-payments/:id",loSbResponseBody)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbResponseBody
    return
endif

loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
    ? "Response Header:"
    ? loHttp.LastHeader
    ? "Failed."
    release loHttp
    release loSbResponseBody
    release loJResp
    return
endif

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "document_id": "<long>",
//   "debitor_name": "<string>",
//   "debitor_iban": "<string>",
//   "mandate_id": "<string>",
//   "mandate_date_of_signature": "<date>",
//   "local_instrument": "COR1",
//   "sequence_type": "FRST",
//   "amount": "<integer>",
//   "reference": "<string>",
//   "created_at": "<dateTime>",
//   "creditor_bic": null,
//   "creditor_iban": "<string>",
//   "creditor_name": "<string>",
//   "debitor_bic": null,
//   "debitor_address_line_1": "<string>",
//   "debitor_address_line2": "<string>",
//   "debitor_country": "<string>",
//   "export_at": null,
//   "export_error": "<string>",
//   "id": "<long>",
//   "remittance_information": null,
//   "requested_at": "Today's date",
//   "updated_at": "<string>",
//   "type": "DEBIT"
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

lcDocument_id = loJResp.StringOf("document_id")
lcDebitor_name = loJResp.StringOf("debitor_name")
lcDebitor_iban = loJResp.StringOf("debitor_iban")
lcMandate_id = loJResp.StringOf("mandate_id")
lcMandate_date_of_signature = loJResp.StringOf("mandate_date_of_signature")
lcLocal_instrument = loJResp.StringOf("local_instrument")
lcSequence_type = loJResp.StringOf("sequence_type")
lcAmount = loJResp.StringOf("amount")
lcReference = loJResp.StringOf("reference")
lcCreated_at = loJResp.StringOf("created_at")
lcCreditor_bic = loJResp.StringOf("creditor_bic")
lcCreditor_iban = loJResp.StringOf("creditor_iban")
lcCreditor_name = loJResp.StringOf("creditor_name")
lcDebitor_bic = loJResp.StringOf("debitor_bic")
lcDebitor_address_line_1 = loJResp.StringOf("debitor_address_line_1")
lcDebitor_address_line2 = loJResp.StringOf("debitor_address_line2")
lcDebitor_country = loJResp.StringOf("debitor_country")
lcExport_at = loJResp.StringOf("export_at")
lcExport_error = loJResp.StringOf("export_error")
lcId = loJResp.StringOf("id")
lcRemittance_information = loJResp.StringOf("remittance_information")
lcRequested_at = loJResp.StringOf("requested_at")
lcUpdated_at = loJResp.StringOf("updated_at")
lcV_type = loJResp.StringOf("type")


release loHttp
release loSbResponseBody
release loJResp

Curl Command

curl -X GET
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/sepa-payments/:id

Postman Collection Item JSON

{
  "name": "Fetch SEPA payment",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/sepa-payments/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "sepa-payments",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of SEPA payment"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/sepa-payments/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"document_id\": \"<long>\",\n  \"debitor_name\": \"<string>\",\n  \"debitor_iban\": \"<string>\",\n  \"mandate_id\": \"<string>\",\n  \"mandate_date_of_signature\": \"<date>\",\n  \"local_instrument\": \"COR1\",\n  \"sequence_type\": \"FRST\",\n  \"amount\": \"<integer>\",\n  \"reference\": \"<string>\",\n  \"created_at\": \"<dateTime>\",\n  \"creditor_bic\": null,\n  \"creditor_iban\": \"<string>\",\n  \"creditor_name\": \"<string>\",\n  \"debitor_bic\": null,\n  \"debitor_address_line_1\": \"<string>\",\n  \"debitor_address_line2\": \"<string>\",\n  \"debitor_country\": \"<string>\",\n  \"export_at\": null,\n  \"export_error\": \"<string>\",\n  \"id\": \"<long>\",\n  \"remittance_information\": null,\n  \"requested_at\": \"Today's date\",\n  \"updated_at\": \"<string>\",\n  \"type\": \"DEBIT\"\n}"
    },
    {
      "name": "Not found",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/sepa-payments/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/sepa-payments/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}