Skip to main content

APIs

Authorization Request

The below covers the structure of the request Unit makes to your API, as well as the two response options - approve or decline.

NameTypeDescription
dataPurchaseAuthorizationRequest / CardTransactionAuthorizationRequest / AtmAuthorizationRequest / IIASAuthorizationRequestThe authorization request possible resources.
Example Request:
{
"data": [
{
"id": "412",
"type": "pendingAuthorizationRequest",
"attributes": {
"createdAt": "2021-06-24T08:10:08.081Z",
"amount": 2000,
"available": 150000,
"status": "Pending",
"partialApprovalAllowed": false,
"merchant": {
"name": "Merchant name",
"type": "6012",
"id": "311204598883"
},
"recurring": false,
"ecommerce": true,
"cardPresent": false,
"direction": "Debit",
"mustBeApproved": false,
"tags": {
"tag": "value"
},
"currencyConversion": {
"originalCurrency": "EUR",
"amountInOriginalCurrency": 1000,
"fxRate": "1.164"
},
"isInternational": true,
"cardNetwork": "Visa"
},
"relationships": {
"authorizationRequest": {
"data": {
"id": "6",
"type": "purchaseAuthorizationRequest"
}
},
"account": {
"data": {
"id": "10001",
"type": "account"
}
},
"customer": {
"data": {
"id": "10000",
"type": "customer"
}
},
"card": {
"data": {
"id": "7",
"type": "card"
}
}
}
}
]
}

Approving an Authorization Request

Response is a JSON:API document.

200 OK

Attributes

NameTypeDescription
amount OptionalintegerOptional. The approved amount (in cents). Can only be specified if the authorization request's partialApprovalAllowed is set to true.
fundingAccount OptionalstringOptional. The id of an alternate account (either the customer's or another's) that should be used for funding the transaction. Please contact Unit to enable this feature.
tags OptionalobjectOptional, See Tags. The specified tags will be inherited by the resulting authorization and transaction resources.
Example Response:
{
"data": {
"type": "approveAuthorizationRequest",
"attributes": {
"amount": 5000
}
}
}

Declining an Authorization Request

Response is a JSON:API document.

200 OK

Attributes

NameTypeDescription
reasonstringThe reason for declining the authorization request. One of AccountClosed, CardExceedsAmountLimit, DoNotHonor, InsufficientFunds, InvalidMerchant, ReferToCardIssuer, RestrictedCard, TransactionNotPermittedToCardholder.
Example Response:
{
"data": {
"type": "declineAuthorizationRequest",
"attributes": {
"reason": "InsufficientFunds"
}
}
}

Get by Id

Get an authorization request resource by id.

VerbGET
URLhttps://api.s.unit.sh/authorization-requests/{id}
Required Scopeauthorization-requests
Timeout (Seconds)5

Response

Response is a JSON:API document.

200 OK

NameTypeDescription
dataPurchaseAuthorizationRequest / CardTransactionAuthorizationRequest / AtmAuthorizationRequestAuthorization Request resource.
curl -X GET 'https://api.s.unit.sh/authorization-requests/1' \
-H "Authorization: Bearer ${TOKEN}"

List

List authorization requests. Filtering and paging can be applied.

VerbGET
URLhttps://api.s.unit.sh/authorization-requests
Required Scopeauthorization-requests
Timeout (Seconds)5

Query Parameters

NameTypeDefaultDescription
page[limit]integer100Optional. Maximum number of resources that will be returned. Maximum is 1000 resources.
page[offset]integer0Optional. Number of resources to skip.
filter[accountId]string(empty)Optional. Filters the results by the specified account id.
filter[customerId]string(empty)Optional. Filters the results by the specified customer id.
filter[merchantCategoryCode][]Integer(empty)Optional. Filter result by their 4-digit ISO 18245 merchant category code (MCC).
filter[fromAmount]Integer(empty)Optional. Filters the result that have an amount that is higher or equal to the specified amount (in cents). e.g. 5000
filter[toAmount]Integer(empty)Optional. Filters the result that have an amount that is lower or equal to the specified amount (in cents). e.g. 7000
curl -X GET 'https://api.s.unit.sh/authorization-requests?page[limit]=20&page[offset]=0' \
-H "Authorization: Bearer ${TOKEN}"

Response

Response is a JSON:API document.

200 OK

NameTypeDescription
dataArray of PurchaseAuthorizationRequest / CardTransactionAuthorizationRequest / AtmAuthorizationRequestArray of authorization request resources.
Example Response:
{
"data": [
{
"type": "purchaseAuthorizationRequest",
"id": "1",
"attributes": {
"createdAt": "2021-06-22T13:39:17.018Z",
"amount": 2500,
"status": "Approved",
"partialApprovalAllowed": false,
"approvedAmount": 2500,
"merchant": {
"name": "Apple Inc.",
"type": 1000,
"category": "",
"location": "Cupertino, CA",
"id": "311204598883"
},
"recurring": false
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10001"
}
},
"card": {
"data": {
"type": "card",
"id": "7"
}
}
}
},
{
"type": "cardTransactionAuthorizationRequest",
"id": "2",
"attributes": {
"createdAt": "2021-06-22T13:41:01.379Z",
"amount": 2500,
"status": "Pending",
"partialApprovalAllowed": false,
"merchant": {
"name": "Apple Inc.",
"type": 1000,
"category": "",
"location": "Cupertino, CA",
"id": "311204598883"
},
"recurring": false
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10001"
}
},
"card": {
"data": {
"type": "card",
"id": "7"
}
}
}
}
]
}