Account · Payments for Programmers

Payments for Programmers

Account

600 words 3 minutes

When creating an Account, The “Account Creatable” datatype is used. In the response from the endpoint an object of the “Account” data type will be returned.

Account Creatable

When calling the order endpoint to create an order, include a creatable order object. Several properties are optional, and for the “items” property, either a number representing the whole order amount, a single Item object or an array of Item objects can be used. If you do not specify a currency when creating an account, it will default to swedish crowns “SEK”.

Property Type Description
number string (optional) Account number in your system
customer Customer (optional) See Customer data type
method Method.Creatable[] See Method data type, may include an empty array
currency string (optional) 3-letter currency code, e.g. “SEK”
schedule `Frequency Schedule`
limit number (optional) Credit limit in the specified currency for the account

Example:

{
    "number": "example Account",
    "customer":{
        "type":"person",
        "name":"Max Exampleperson",
        "email":"[email protected]",
    },
    "method": [],
    "schedule":"quarterly",
    "limit":100,
    "currency":"EUR"
}

Account

Responses from the Account endpoint will contain an Account object, which includes an “id” and may include a “status”, subscriptions and “link” fields in addition to the ones in the Creatable type. Newly created Accounts will also have their balance initialised.
The “balance” field in the account has all of the Items in it that have been billed towards the account total, but not yet put into an order. See the Balance Endpoint for a more detailed explanation.

Property Type Description
id string Unique 16-letter identifier in our system
number string (optional) Account number in your system
customer Customer (optional) See Customer data type
method Method[] See Account Method data type
link AccountLink[] (optional) See AccountLink data type
status string (optional) String indicating the status
subscription Subscription[] See Subscription data type
currency string (optional) 3-letter currency code, e.g. “SEK”
schedule `Frequency Schedule`
limit number (optional) Credit limit in the specified currency for the account
total number Current total of the account in the specified currency. Initialised to 0
balance Item[] See Item[] data type.
due string (optional) date in shortened ISO format

Example:

{
    "id":"1234567890abcdef",
    "number": "example Account",
    "customer":{
        "type":"person",
        "name":"Max Exampleperson",
        "email":"[email protected]",
    },
    "method": [],
    "link": [
        {
        "url": "http://localhost:7071/account/1234567890abcdef/link/0987654321098765",
        "id": "0987654321098765",
        "created": "2020-12-08T09:19:42.835Z",
        "expires": "2020-12-11T09:19:42.835Z",
        "key": "abc.def.ghi",
        "contact": "[email protected]",
        "used": false
        }
    ],
    "status":"created",
    "subscription":[],
    "currency":"EUR",
    "schedule":"quarterly",
    "limit":100,
    "total":0,
    "balance":[]
}

Account Payment Method

For automatic payment with an account, a payment method has to be created first. This can be done either with already tokenized cards or through the Onboard process.

Method Creatable

Property Type Description
type "token" Indicator for method type
card string Tokenized payment information

Method

Property Type Description
type `“card” “token”`
created string Date in ISO format
token string Tokenized payment information
scheme string String indicating card scheme, ex. “visa”
iin string First 6 letters of the credit card number
last4 string Last 4 letters of the credit card number
expires [number,number] Expiry date of the credit card

Example:

{
    "type": "card",
    "created": "2020-03-13T13:37:13.123Z",
    "token": "abc.def.ghi",
    "scheme": "visa",
    "iin": "411111",
    "last4": "1111",
    "expires": [ 2, 22 ],
}

Information associated to single use login links for the account page.

Property Type Description
url string Login link for the account
created string Date in ISO format
expires string Date in ISO format, indicating expiry date of the link
key string Tokenized account login key
contact string (optional) Additional contact information
used boolean Indicating whether this link has been used before
Example:
{
    "url": "http://localhost:7071/account/1234567890abcdef/link/0987654321098765",
    "id": "0987654321098765",
    "created": "2020-12-08T09:19:42.835Z",
    "expires": "2020-12-11T09:19:42.835Z",
    "key": "abc.def.ghi",
    "contact": "[email protected]",
    "used": false
}