Card Restrictions
Request URL
POST /card/:AFiCardId/restriction
Description
This endpoint makes modifications to the restrictions set on a card. The card is identified by a path parameter. The available restrictions include:
- Enable/disable the card on specific days of the week
- Enable/disable the card at specific times of day
- Allow or disallow transactions for specific Merchant Category Codes (MCCs)
Days of the week are indicated by the values 0 (Sunday) through 6 (Saturday). To enable or disable the card for a specific day, set the day value to true or false.
Time ranges are indicated by the codes xxn1yyn2, where xx and yy are either am or pm, and n1 and n2 are the specific hours that begin and end the range using a 12-hour clock.
Note that the restrictedMCCs
property and the allowedMCCs
property cannot both be present in the request body simutaneously. Doing so will cause an error to be thrown. If the restrictedMCCs
property is present in the request body, the allowedMCCs
property will automatically be set to null and vice versa. If you try to add allowedMCCs
restrictions to a card that already has restrictedMCCs
(and vice versa), an error will be thrown. Also, any MCC code listed in the restrictedMCCs object will be set to restricted (false), regardless of the property value given to that MCC code key in the object.
If .allowedMCCs
is given, .restrictedMCCs
is dropped and vice versa.
If .allowedMCCs
is given, transactions from all other MCCs will be rejected.
If .restrictedMCCs
is given, only transactions from the given MCCs will be rejected.
Schema
Property table for schema 1 for card/:AFiCardId/restriction
Property | Description | Required | Schema |
---|---|---|---|
AFiCardId | ampliFi ID for the card | Yes | { "type": "string" } |
dayOfWeek | Restrictions for specific days of the week, 0 (Sunday) through 6 (Saturday) | No | dayOfWeek object |
timesOfDay | Restrictions for specific times of the day, xxn1yyn2, where xx and yy are either am or pm, and n1 and n2 are the specific hours that begin and end the range using a 12-hour clock | No | { "type": "object", "required": [] } |
allowedMCCs | List of allowed MCC codes. If present, all other MCC codes will be disallowed. This property cannot be present at the same time as the restrictedMCCs property. | No | { "type": "object", "required": [] } |
Property table for schema 2 for card/:AFiCardId/restriction
Property | Description | Required | Schema |
---|---|---|---|
AFiCardId | ampliFi ID for the card | Yes | { "type": "string" } |
dayOfWeek | Restrictions for specific days of the week, 0 (Sunday) through 6 (Saturday) | No | dayOfWeek object |
timesOfDay | Restrictions for specific times of the day, xxn1yyn2, where xx and yy are either am or pm, and n1 and n2 are the specific hours that begin and end the range using a 12-hour clock | No | { "type": "object", "required": [] } |
restrictedMCCs | List of disallowed MCC codes. If present, all other MCC codes will be allowed. This property cannot be present at the same time as the allowedMCCs property. | No | { "type": "object", "required": [] } |
Property table for schema 3 for card/:AFiCardId/restriction
Property | Description | Required | Schema |
---|---|---|---|
AFiCardId | ampliFi ID for the card | Yes | { "type": "string" } |
dayOfWeek | Restrictions for specific days of the week, 0 (Sunday) through 6 (Saturday) | No | dayOfWeek object |
timesOfDay | Restrictions for specific times of the day, xxn1yyn2, where xx and yy are either am or pm, and n1 and n2 are the specific hours that begin and end the range using a 12-hour clock | No | { "type": "object", "required": [] } |
Property table for dayOfWeek object
Property | Description | Required | Schema |
---|---|---|---|
0 | true if restriction applies to Sunday | No | { "type": "boolean", "nullable": true } |
1 | true if restriction applies to Monday | No | { "type": "boolean", "nullable": true } |
2 | true if restriction applies to Tuesday | No | { "type": "boolean", "nullable": true } |
3 | true if restriction applies to Wednesday | No | { "type": "boolean", "nullable": true } |
4 | true if restriction applies to Thursday | No | { "type": "boolean", "nullable": true } |
5 | true if restriction applies to Friday | No | { "type": "boolean", "nullable": true } |
6 | true if restriction applies to Saturday | No | { "type": "boolean", "nullable": true } |
Request Body
{
"dayOfWeek": {
"0": false,
"6": true
},
"timesOfDay": {
"am6pm12": false,
"pm12pm9": true,
"pm9am6": true
},
"allowedMCCs": {
"001": false,
"002": true
}
}
Snippet Examples
javascript
const axios = require('axios');
const data = {
"dayOfWeek": {
"0": false,
"6": true
},
"timesOfDay": {
"am6pm12": false,
"pm12pm9": true,
"pm9am6": true
},
"allowedMCCs": {
"001": false,
"002": true
}
};
const config = {
method: 'POST',
url: '${AMPLIFI_BASE_URL}/card/:AFiCardId/restriction',
headers: {
'Content-Type': "application/json",
'token': "A long random string token received from /token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "AMPLIFI_BASE_URL/card/:AFiCardId/restriction" --data "{ \"dayOfWeek\":{ \"0\":false, \"6\":true }, \"timesOfDay\":{ \"am6pm12\":false, \"pm12pm9\":true, \"pm9am6\":true }, \"allowedMCCs\":{ \"001\":false, \"002\":true }}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"
Successful Response Examples
200 CARD/:AFICARDID/RESTRICTION SUCCESSFUL RESPONSE MODIFYING RESTRICTIONS
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
PARAMETERS
Parameter | Description | Value |
---|---|---|
AFiCardId | [required] | qwegalq11xn6prxjp |
REQUEST BODY
{
"dayOfWeek": {
"0": false,
"6": true
},
"timesOfDay": {
"am6pm12": false,
"pm12pm9": true,
"pm9am6": true
},
"allowedMCCs": {
"001": false,
"002": true
}
}
RESPONSE BODY