Authorization API
API reference
Create Credit Authorization

This documentation page contains information common for the following endpoints:

Most request properties are shared across all these endpoints. These common properties are listed in the Request Common Properties section. Additional endpoint-specific properties are detailed in their respective sections.

All endpoints return the same response objects, which are documented in the Responses section.

Request Common Properties

NameData TypeMandatory/Default ValueDescription
CustomerCustomerMandatoryCustomer personal information
InvoicingAddressAddressMandatoryAddress for the Invoice
DeliveryAddressAddressOptionalMandatory if UseDifferentDeliveryAddress = true
UseDifferentDeliveryAddressBooleanOptional, falseIf delivery address is different from invoicing address
ItemsArray of ItemMandatoryA list of items representing the individual rows on an invoice. Individual items may have a negative value but the total sum of all items must be positive.
OrderReferenceString(50)MandatoryPartner custom ID reference.
PosIDString(10)MandatoryID of point of sales. To identify locations or stores.
DescriptionString(100)OptionalFree text description of the order
EmailInvoiceBooleanOptionalIf to send the invoice by email. If not specified the default value from Partner configuration is used.
ForcedDistributionMethodEnumerationOptionalIf specified it overrides EmailInvoice property and the default value from Partner configuration. Possible values:
1 = No print
2 = Send printed
3 = Send email
4 = Partner handled
LoyaltyNumberString(10)OptionalCurrently only stored, reserved for future needs
IdValidationCallbackUrlStringOptionalOptional ID validation redirect URL. If used, it overrides the default URL specified in the partner site configuration

Customer

NameData TypeMandatory/Default ValueDescription
IdentificationNumberStringMandatorySocial security number or national ID number (depending on market)
UserLanguageCodeIntMandatoryCustomer languages - used in returned informational and error message (based on country ISO codes (opens in a new tab))
208 = Dk
246 = Fi
578 = No
752 = Se
826 = En
PhoneString(15)MandatoryCustomer mobile phone number. Validation according to country of origin.
EmailString(60)Mandatory

Address

NameData TypeMandatory/Default ValueDescription
FirstNameString(40)Mandatory
LastNameString(40)Mandatory
AddressLine1String(40)MandatoryTypically a street name and street number
AddressLine2String(40)Optional
CityString(30)Mandatory
ZipStringMandatoryFormat is validated depending on the market

Item

NameData TypeMandatory/Default ValueDescription
DescriptionString(35)MandatoryItem description - typically placed on an invoice line
NotesString(35)OptionalAdditional notes - might not be displayed on the invoice.
AmountDecimalMandatoryThe single item amount. Can be negative, zero or positive. The tax amount should be included in this amount.
TaxCodeString(20)OptionalThe tax code to be displayed on the invoice. The value should be in %. If the tax code is 25% send in 25.
TaxAmountDecimalOptional, 0.00The item tax amount. Can be zero or positive.
ProductGroupString(50)OptionalCurrently only stored, reserved for future needs
QuantityIntOptional, 1The number of items - Amount is multiplied by Quantity to get the total amount

Responses

The format of the response HTTP status and the response body depends on the outcome of the credit decision - see Flow Details

201 Created - Credit Approved - ID Validation Not Required

See Flow Details step 3a

NameData TypeDescription
CreditLimitDecimalCredit amount granted
AuthorizationIdString (GUID)Unique ID of the credit authorization - use in subsequent Status or Order Management calls

Example

{
    "creditLimit": 2000.0,
    "forced": false,
    "authorizationId": "e3c7b22b65654afba1d3efee814c59c2"
}

202 Accepted - Credit Approved - ID Validation Required

See Flow Details Main Flow

NameData TypeDescription
ForcedBoolean
RedirectUrlDecimalLink to redirect the Customer for ID validation
AuthorizationIdString (GUID)Unique ID of the credit authorization - use in subsequent Status or Order Management calls

Example

{
    "redirectUrl": "https://idp-bankid.avarda.com/connect/authorize?response_type=code&state=9xRGFeJgNuJ_RdP-MsbHlw&code_challenge=8WbbgCdreGpC962E6tvEtJLP4UdNao5V7WStfFsIpnM&code_challenge_method=S256&client_id=auth-api&scope=openid%20profile&redirect_uri=https%3A%2F%2Flocalhost%3A5001%2Fidcallback%2Fbankidswe&login_hint=198808183092&ui_locales=fi&authorization_id=6a23a60d-f59e-4dcc-871a-0ca7fd294590",
    "forced": false,
    "authorizationId": "6a23a60df59e4dcc871a0ca7fd294590"
}

400 Bad Request - Invalid Request Data

See Flow Details step 2a

The response is in a standard RFC 9457 (opens in a new tab) format and contains list of validation errors in plain English. Note that it is expected that the Partner validates the data on its own UI. The validation on Authorization API is provided as a safeguard of the last resort and the validation messages are intended as a hint for the developers - therefore they are not localized into the Customer language.

Example

{
    "errors": {
        "Customer.Email": [
            "Email is not a valid email address."
        ],
        "Customer.Phone": [
            "Phone is not a valid phone number."
        ]
    },
    "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": "00-aaa3b6e163636ad193bbb9dd3f81e74e-0b08a01eae50f098-01"
}

422 Unprocessable Entity - Credit Authorization Rejected

See Flow Details step 3b

NameData TypeDescription
ErrorCodeIntType of the error
ErrorMessageStringError details localized to Customer language
AuthorizationIdString (GUID)ID of the rejected credit authorization for future references

Example

{
    "errorCode": 2,
    "errorMessage": "Credit not approved please try different payment method",
    "authorizationId": "3b2309d4565446b1996dcb92fe40f332"
}

List of Errors

ErrorCodeErrorMessage (English)
1,2Credit not approved please try different payment method
3Credit not approved please check that name and address details match registered address
4Credit not approved due to incorrect amount
5,6The application cannot be granted due to an invalid personal identity number. Please check your social security number or choose another payment method at checkout
7Invalid email format

The ErrorMessage provides a hint as to why the credit was rejected. The ErrorCode further narrows down the reason; however, this code is only meaningful to Avarda. If you need to investigate a particular rejected authorization, pass the code to Avarda support for assistance.

500 Internal Server Error - Technical Error

See Flow Details step 3c

NameData TypeDescription
ErrorCodeIntType of the error
ErrorMessageStringError details
AuthorizationIdString (GUID)ID of the failed credit authorization

Example

{
    "errorCode": 101,
    "errorMessage": "Service internal error, please try later or contact the support desk",
    "authorizationId": "ddaf5c6caec841c9a1c7d60256af32eb"
}