Digital Payments

Delete Token

How to delete tokens.

Edit "Delete Token" on GitHub

Delete Unscheduled, Recurrence Or Payment Tokens

Payers should be able to delete tokens connected to them. How to do this is described in the example below. Note that the different token types have different responses. The state field must have the state Deleted when deleting the token. No other states are supported.

Delete recurrenceToken Request

Request

1
2
3
4
PATCH /psp/paymentorders/recurrenceTokens/5a17c24e-d459-4567-bbad-aa0f17a76119 HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json;version=3.1/3.0/2.0      // Version optional for 3.0 and 2.0
1
2
3
4
{
    "state": "Deleted",
    "comment": "Comment on why the deletion is happening"
}

Delete recurrenceToken Response

Response

1
2
3
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8; version=3.1/3.0/2.0
api-supported-versions: 3.1/3.0/2.0
1
2
3
4
5
6
{
    
    "token": "5a17c24e-d459-4567-bbad-aa0f17a76119", 
    "isDeleted": true
    
}

Delete unscheduledToken Request

Request

1
2
3
4
PATCH /psp/paymentorders/unscheduledTokens/5a17c24e-d459-4567-bbad-aa0f17a76119 HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json;version=3.1/3.0/2.0      // Version optional for 3.0 and 2.0
1
2
3
4
{
    "state": "Deleted",
    "comment": "Comment on why the deletion is happening"
}

Delete unscheduledToken Response

The example shows a token connected to a card. The instrument parameters and display name will vary depending on the instrument.

Response

1
2
3
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8; version=3.1/3.0/2.0
api-supported-versions: 3.1/3.0/2.0
1
2
3
4
5
6
7
8
9
10
11
12
{
    
    "token": "5a17c24e-d459-4567-bbad-aa0f17a76119", 
    "instrument": "CreditCard",
    "instrumentDisplayName": "123456xxxxxx1111"
    "correlationId": "e2f06785-805d-4605-bf40-426a725d313d",
    "instrumentParameters": {
        "cardBrand": "Visa",
        "expiryDate": "MM/YYYY"
    }
    
}

Delete paymentToken Request

Request

1
2
3
4
PATCH /psp/paymentorders/paymentTokens/5a17c24e-d459-4567-bbad-aa0f17a76119 HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json;version=3.1/3.0/2.0      // Version optional for 3.0 and 2.0
1
2
3
4
{
    "state": "Deleted",
    "comment": "Comment on why the deletion is happening"
}

Delete paymentToken Response

The example shows a token connected to a card. The instrument parameters and display name will vary depending on the instrument.

Response

1
2
3
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8; version=3.1/3.0/2.0
api-supported-versions: 3.1/3.0/2.0
1
2
3
4
5
6
7
8
9
10
11
12
13
{
    
    "paymentToken": "5a17c24e-d459-4567-bbad-aa0f17a76119",
     
    "instrument": "CreditCard",
    "instrumentDisplayName": "123456xxxxxx1111"
    "correlationId": "e2f06785-805d-4605-bf40-426a725d313d",
    "instrumentParameters": {
        "cardBrand": "Visa",
        "expiryDate": "MM/YYYY"
    }
    
}

Delete payerOwnedToken Request

Request

1
2
3
4
5
6
7
8
9
PATCH /psp/paymentorders/payerownedtokens/<payerReference> HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
  "state": "Deleted",
  "comment": "Comment stating why this is being deleted"
}

Delete payerownedToken Response

Response

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
31
32
33
34
HTTP/1.1 200 OK
Content-Type: application/json

{
  "payerOwnedTokens": {
        "id": "/psp/paymentorders/payerownedtokens/{payerReference}",
        "payerReference": "{payerReference}",
        "tokens": [
            {
                "tokenType": "Payment",
                "token": "{paymentToken}",
                "instrument": "Invoice-payexfinancingno",
                "instrumentDisplayName": "260267*****",
                "correlationId": "e2f06785-805d-4605-bf40-426a725d313d",
                "instrumentParameters": {
                    "email": "hei@hei.no",
                    "msisdn": "+4798765432",
                    "zipCode": "1642"
                }
            },
            {
                "tokenType": "Payment",
                "token": "{paymentToken}",
                "instrument": "CreditCard",
                "instrumentDisplayName": "492500******0004",
                "correlationId": "e2f06785-805d-4605-bf40-426a725d313d",
                "instrumentParameters": {
                    "expiryDate": "12/2020",
                    "cardBrand": "Visa"
                }
            }
        ]
    }
}