Standalone Credit
AuthorizeDirectInvoiceEID
POST /CheckOut2Api/v2/AuthorizeDirectInvoiceEID

The method authorize an invoices based on provided parameters and returns purchaseid. If Electronic ID validation is required the function will respond only with purchaseid and a flag that electronicID validation is required.

  1. Call AuthorizeDirectInvoiceEID
  2. Check response – if no electronic ID validation is required then response message contains everything to complete the order.
  3. IF ELECTRONIC ID VALIDATION IS REQUIRED:
  4. Check response – if electronic ID validation is required then response contains only purchaseid and IsElectronicValidationNeeded = true. Merchant now needs to redirect the user to a predefined URL where Avarda offer ElectronicID validation. URL: /CheckOut2ElectronicId/?externalId={PURCHASEID}&returnUrl={yourreturnurl.com}
  5. After electronicID validation is performed then Avarda redirect back to defined returnURL. Example: https://yourreturnurl.com/?externalId=d736dd5fea853b18a30fd2413ebfcab5&status=OK
  6. Merchant checks status on the purchase via GetPaymentStatus. If ok then fulfill the order

To send the invoice and debit the end customer an extra call to PurchaseOrder is required when goods are delivered.

Input Parameters

NameData TypeDefault ValueDescription
IdentificationNumberStringAn empty stringSocial security number of the customer
IsB2BBooleanFALSESwitching between Business to Customer and Busines to business
ReferenceNameStringAn empty string
ReferenceIdStringAn empty string
UserLanguageCodeStringen-USThe culture to use in check-out form. Affects both language and value formatting. Supported values:
en-US: English
sv-SE: Swedish
fi-FI: Finnish

da-DK: Danish

nb-NO: Norwegian
DescriptionString (max. 4000 characters)An empty stringA textual description of the purchase without any specific format that the partner may provide.
PriceDecimalNone. Must be specifiedThe total amount to pay. Must be greater than 0.
PhoneString (max. 15 characters not counting white spaces, so technically any length)An empty stringCustomer’s phone number to pre-fill in the form.
MailString (max. 60 characters)An empty stringCustomer’s e-mail address to pre-fill in the form.
IsPhoneAndMailEditableBooleantrueWhether to allow the user to edit the Phone and Mail fields.
InvoicingFirstNameString (max. 40 characters)An empty stringCustomer’s first name. This is used also as a first name of the person on the invoicing address.
InvoicingLastNameString (max. 40 characters)An empty stringCustomer’s last name. This is used also as a last name of the person on the invoicing address.
InvoicingAddressLine1String (max. 40 characters)An empty stringThe line of the invoicing address that appears below customer’s name. Usually contains a street name and an ordinal number of the building.
InvoicingAddressLine2String (max. 40 characters)An empty stringThe line of the invoicing address that appears below customer’s name. Usually contains a street name and an ordinal number of the building.
InvoicingZipString (max. 6 characters)An empty stringThe ZIP on the invoicing address.
InvoicingCityString (max. 30 characters)An empty stringThe city on the invoicing address.
IsInvoicingEditableBooleanFalseWhether the customer can edit the attributes related to invoicing address manually.
DeliveryFirstNameString (max. 40 characters)An empty stringFirst name of the person on the delivery address.
DeliveryLastNameString (max. 40 characters)An empty stringLast name of the person on the delivery address.
DeliveryAddressLine1String (max. 40 characters)An empty stringThe line of the delivery address that appears below customer’s name. Usually contains a street name and an ordinal number of the building.
DeliveryAddressLine2String (max. 40 characters)An empty stringThe line of the delivery address that appears below customer’s name. Usually contains a street name and an ordinal number of the building.
DeliveryZipString (max. 6 characters)An empty stringThe ZIP on the delivery address.
DeliveryCityString (max. 30 characters)An empty stringThe city on the delivery address.
IsDeliveryEditableBooleanFalseEnabling/disabling checkbox visibility for delivery address.
UseDifferentDeliveryAddressBooleanFalseThe initial state of the “Same delivery address” checkbox on the check-out form.
ItemsClass List of ItemsNone. Must be specifiedA 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.
LoyaltyNumberStringAn empty stringCan be a number of a customer’s membership card.
ProductGroupStringAn empty stringString that defines the product category.
OrderReferenceStringAn empty stringMerchant custom ID reference.
ReleasedByNameStringAn empty string
PartnerCodeString
DefaultPaymentMethodEnumeration PaymentMethodInvoiceA payment method to pre-select when the check-out form is shown for the first time.
OfferRecPmtBooleanfalse
PreSelectRecPmtBooleanfalse
CustomerTokenStringAn empty valueCustomerToken is a key associated with customer details.
CompanyNameStringn empty string
EmailinvoiceNullable intnull0 = Do not send ivoice by email.
1 = Send invoice by email.
empty = no update.
OfferNewsLetterBooleanfalse

Items

The class represents a single row that appears on an invoice. Typically a purchased commodity but it can also be a more abstract think such as a discount with a negative value.

Example request

{
  {
  "IdentificationNumber": "191704109279",
  "Description": null,
  "ReferenceName": "Test",
  "ReferenceId": "Test",
  "UserLanguageCode": null,
  "Phone": "041234567",
  "Mail": "Testperson@avarda.comm",
  "IsPhoneAndMailEditable": null,
  "Price": 82.72,
  "InvoicingFirstName": "Testname",
  "InvoicingLastName": "Testlastname",
  "InvoicingAddressLine1": "Address X11",
  "InvoicingZip": "11136 ",
  "InvoicingCity": "Jyväskylä",
  "DeliveryFirstName": "Testname",
  "DeliveryLastName": "Testlastname",
  "DeliveryAddressLine1": "Address X11",
  "DeliveryZip": "11136 ",
  "DeliveryCity": "JYVÄSKYLÄ",
  "IsDeliveryEditable": false,
  "UseDifferentDeliveryAddress": true,
  "Items": [
    {
      "Description": "HD7462/21 Daily Collection kahvinke",
      "Notes": "HH1018333",
      "Amount": 39.9,
      "TaxCode": "24",
      "TaxAmount": 7.72
    },
    {
      "Description": "Ultra Kevät -pussilakanasetti, jade",
      "Notes": "HH1010279",
      "Amount": 35.92,
      "TaxCode": "24",
      "TaxAmount": 6.95
    },
    {
      "Description": "Toimitus- ja kasittelykulut",
      "Notes": "Toimituskulut",
      "Amount": 6.9,
      "TaxCode": "24",
      "TaxAmount": 1.34
    }
  ],
 
  "ProductGroup": null,
  "LoyaltyNumber": null,
  "OrderReference": "2000099999",
  "DefaultPaymentMethod": 0,
  "HidePersonalDetails": "0",
  "CustomerToken": "",
  "OfferRecPmt": true,
  "PreSelectRecPmt": true,
  "CompanyName": "string",
  "Emailinvoice": 0,
  "OfferNewsLetter": true
 }
}

Output parameters

Return Value – If no extra electronicID validation is required. Process is Done.

NameData TypeDescription
ExternalIdStringAn ID acquired when initializing a Check-Out session.
AccountNumberDecimalThe bank account number associated with the payment.
FirstNameStringCustomer’s first name. This is used also as a first name of the person on the invoicing address.
LastNameStringCustomer’s last name. This is used also as a last name of the person on the invoicing address.
RequireDeliveryAuthorizationBoolean
CreditLimitDecimal
ErrorTypeDecimal
ErrorMessageString

Output parameters Example

{
  "ExternalId": "d736dd5fea853b18a30fd2413ebfcab5",
  "AccountNumber": "198631249625058",
  "FirstName": "Testname",
  "LastName": "Testlastname",
  "RequireDeliveryAuthorization": false,
  "CreditLimit": 4000,
  "ErrorType": 0,
  "ErrorMessage": null
}

Return Value – When extra electroniID validation is required.

NameData TypeDescription
ExternalIdStringAn ID acquired when initializing a Check-Out session.
IsElectronicValidationNeededBoolean
ErrorTypeDecimal
ErrorMessageString

Output parameters Example

{
  "ExternalId": "d736dd5fea853b18a30fd2413ebfcab5",
  "IsElectronicValidationNeeded": true,
  "ErrorType": 0,
  "ErrorMessage": null
}

Redirect user to ID validation

Redirect user to following URL where ElectronicID validation is performed.

PROD:

https://online.avarda.org/CheckOut2/CheckOut2ElectronicId/?externalId={PURCHASEID}&returnUrl={yourreturnurl.com}

TEST

https://stage.avarda.org/CheckOut2/CheckOut2ElectronicId/?externalId={PURCHASEID}&returnUrl={yourreturnurl.com}

Callback Success

https://yourreturnurl.com/?externalId=d736dd5fea853b18a30fd2413ebfcab5&status=OK

Merchant: calls GetPurchaseStatus and if Completed then fulfill the order.

Callback Failed

https://yourreturnurl.com/?externalId=d736dd5fea853b18a30fd2413ebfcab5&status=Cancel

Merchant: offer other payment method or try electronic id validation again.

Error messages

{
  "ErrorCode": "30154",
  "ErrorDetail": null,
  "UserErrorMessage": "CreditNotApproved",
  "DetailedErrorMessage": "(30154) Application denied. Choose a different payment option",
  "LocalizedErrorMessage": "Luottoa lasku- tai tilimaksuun ei voitu myöntää. Ole hyvä ja valitse toinen maksutapa kassalla."
}
Error Message
Address (in delivery address) must be between 0 and 40 characters.
Address (in invoicing address) must be between 0 and 40 characters.
Address (in invoicing address) should not be empty.
Amount can’t be empty!
Checkout site is not allowed to work with B2b.
City (in delivery address) must be between 0 and 30 characters.
City (in invoicing address) must be between 0 and 30 characters.
City (in invoicing address) should not be empty.
Customer Token is not valid.
Description must be between 0 and 4000 characters.
E-mail is not a valid email address.
E-mail must be between 0 and 60 characters.
E-mail should not be empty.
EmailInvoice must be equal 0, 1 or empty
Identification Number should not be empty.
Invalid or not supported UserLanguageCode.
Item Amount must be specified.
Item description must be specified and must not be longer than 35 characters or empty.
Item notes must not be longer than 35 characters.
Items List must contain at least one item.
Name (in delivery address) must be between 0 and 40 characters.
Name (in invoicing address) must be between 0 and 100 characters.
Name (in invoicing address) must be between 0 and 40 characters.
Name (in invoicing address) should not be empty.
Number of notes characters exceeded
Order Reference should not be empty.
Payment Terms should not be empty.
Phone Number must be between 0 and 15 characters.
Phone should not be empty.
Price must be either 0 (in case of no items), or greater than or equal to 0 and greater than or equal to sum of item prices.
Price should not be empty.
Site has no invoice account class associated.
SSN is invalid.
TermsAndConditionsUrl is not in valid format
The items amount can have a maximum of 2 decimal places.
The items tax amount can have a maximum of 2 decimal places.
The price can have a maximum of 2 decimal places.
Total price is not equal to sum of item prices
ZIP (in delivery address) must be between 0 and 10 characters.
ZIP (in invoicing address) must be between 0 and 10 characters.
ZIP (in invoicing address) should not be empty.