Swish

Metadata

Store payment associated data for later use.

Edit "Metadata" on GitHub

Metadata

Metadata can be used to store data associated to a payment that can be retrieved later by performing a GET on the payment. Swedbank Pay does not use or process metadata, it is only stored on the payment so it can be retrieved later alongside the payment. An example where metadata might be useful is when several internal systems are involved in the payment process, and the payment creation is done in one system and post-purchases take place in another. In order to transmit data between these two internal systems, the data can be stored in metadata on the payment so the internal systems do not need to communicate with each other directly. The usage of metadata field is shown in the abbreviated Purchase request below.

Metadata Request

Request

1
2
3
4
POST /psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  "payment": {
    "operation": "Purchase",
    "intent":  "Sale", 
    "currency": "SEK",
    "description": "Test Purchase",
    "userAgent": "Mozilla/5.0...",
    "language": "sv-SE",
        "metadata": {
        "key1": "value1",
        "key2": 2,
        "key3": 3.1,
        "key4": false
    },
    "urls": {
      "hostUrls": ["https://example.com"],
      "completeUrl": "https://example.com/payment-completed"
    },
    "payeeInfo": {
      "payeeId": "5cabf558-5283-482f-b252-4d58e06f6f3b",
      "payeeReference": "CD1234",
    },
    "payer": {
      "payerReference": "AB1234",
    },
    "prefillInfo": {
        "msisdn": "+4798765432"
    }
  }
}
Parameter Type
metadata string, boolean, integer,decimal

GET Request

Request

1
2
3
4
GET /psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  "payment": {
    "operation": "Purchase",
    "intent":  "Sale", 
    "currency": "SEK",
    "description": "Test Purchase",
    "userAgent": "Mozilla/5.0...",
    "language": "sv-SE",
        "metadata": {
        "key1": "value1",
        "key2": 2,
        "key3": 3.1,
        "key4": false
    },
    "urls": {
      "hostUrls": ["https://example.com"],
      "completeUrl": "https://example.com/payment-completed"
    },
    "payeeInfo": {
      "payeeId": "5cabf558-5283-482f-b252-4d58e06f6f3b",
      "payeeReference": "CD1234",
    },
    "payer": {
      "payerReference": "AB1234",
    },
    "prefillInfo": {
        "msisdn": "+4798765432"
    }
  }
}

GET Response

Response

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
7
8
9
10
{
    "payment": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "metadata": {
        "id": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/metadata",
        "key1": "value1",
        "key2": 2,
        "key3": 3.1,
        "key4": false
    }
}