../credit-account
Integrate to PayEx Credit Account API
Accounts
Request
GET /ledger/credit-account/v1/XXX/accounts HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
If the authorization post succeeds, or if a get method is performed to retrieve an existing authorization, it should respond with something like the following:
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "/ledger/credit-account/v1/501/accounts/1234567",
"accountNo": "1234567",
"startDate": "2018-05-21",
"description": null,
"accountProfileType": "accountType1 | accountType2 | accountType3 etc.",
"accountAlias" : "accountAlias1 | accountAlias2 etc.",
"customerNo" : "123789654",
"status" : "open | pending-close | closed",
"creditLimit": 2000.00,
"balance" : -1900.0,
"reservedAmount": 50.0,
"availableAmount": 50.0,
"openBill" : {
"amountToBePayed" : 250.0,
"bill" : "/ledger/credit-account/v1/501/accounts/123456/bills/963",
"dueDate" : "2019-12-10",
"billType" : "Bill"
},
"charityDonation": true,
"interestRate": {
"debtInterest" : 10.00,
"penaltyInterest": 15.00
},
"bankPayment": {
"bankAccountNo": "123",
"bankAccountType": "BGSE",
"bic": "123456",
"iban": "SE12345678945631",
"paymentReference": "54867165675646"
},
"activeDirectDebitOrder": {
"paymentType": "AUTOGIRO",
"executionDate": "2020-01-01",
"amount" : 200.0
},
"directDebit": "/ledger/credit-account/v1/501/accounts/123456/direct-debit",
"cards": "/ledger/credit-account/v1/501/accounts/123456/cards",
"transactions": "/ledger/credit-account/v1/501/accounts/123456/transactions",
"currency": "sek",
"bills": "/ledger/credit-account/v1/501/accounts/123456/bills",
"customer": "/ledger/customers/v1/501/customer/123456",
"operation" : [
{
"rel" : "add-card-info",
"method" : "post",
"href" : "/ledger/credit-account/v1/501/accounts/123456/cards"
},
{
"rel" : "request-close-account",
"method" : "post",
"href" : "/ledger/credit-account/v1/501/accounts/123456/request-close-account"
},
{
"rel" : "apply-for-raised-credit-limit",
"method" : "post",
"href" : "/ledger/credit-account-onboardings/v1/501/accounts/123456/apply-for-raised-credit-limit"
},
{
"rel" : "partial-update",
"method" : "patch",
"href" : "/ledger/credit-account-onboardings/v1/501/accounts/123456"
}
]
}
Content-Type: application/json
{
"@id": "/ledger/credit-account/v1/501/accounts/1234567",
"accountNo": "1234567",
"startDate": "2018-05-21",
"description": null,
"accountProfileType": "accountType1 | accountType2 | accountType3 etc.",
"accountAlias" : "accountAlias1 | accountAlias2 etc.",
"customerNo" : "123789654",
"status" : "open | pending-close | closed",
"creditLimit": 2000.00,
"balance" : -1900.0,
"reservedAmount": 50.0,
"availableAmount": 50.0,
"openBill" : {
"amountToBePayed" : 250.0,
"bill" : "/ledger/credit-account/v1/501/accounts/123456/bills/963",
"dueDate" : "2019-12-10",
"billType" : "Bill"
},
"charityDonation": true,
"interestRate": {
"debtInterest" : 10.00,
"penaltyInterest": 15.00
},
"bankPayment": {
"bankAccountNo": "123",
"bankAccountType": "BGSE",
"bic": "123456",
"iban": "SE12345678945631",
"paymentReference": "54867165675646"
},
"activeDirectDebitOrder": {
"paymentType": "AUTOGIRO",
"executionDate": "2020-01-01",
"amount" : 200.0
},
"directDebit": "/ledger/credit-account/v1/501/accounts/123456/direct-debit",
"cards": "/ledger/credit-account/v1/501/accounts/123456/cards",
"transactions": "/ledger/credit-account/v1/501/accounts/123456/transactions",
"currency": "sek",
"bills": "/ledger/credit-account/v1/501/accounts/123456/bills",
"customer": "/ledger/customers/v1/501/customer/123456",
"operation" : [
{
"rel" : "add-card-info",
"method" : "post",
"href" : "/ledger/credit-account/v1/501/accounts/123456/cards"
},
{
"rel" : "request-close-account",
"method" : "post",
"href" : "/ledger/credit-account/v1/501/accounts/123456/request-close-account"
},
{
"rel" : "apply-for-raised-credit-limit",
"method" : "post",
"href" : "/ledger/credit-account-onboardings/v1/501/accounts/123456/apply-for-raised-credit-limit"
},
{
"rel" : "partial-update",
"method" : "patch",
"href" : "/ledger/credit-account-onboardings/v1/501/accounts/123456"
}
]
}
Resource properties
Property | Data type | Format | Modify (patch) | Description |
---|---|---|---|---|
@id | string | Maxlength: | Uri of the specific account | |
accountNo | string | Maxlength: 50 | The identifier of the account | |
startDate | date | ISO 8601 | Date when the account was started | |
description | string | Maxlength: 200 | A description of the type of account | |
accountProfileType | string | Maxlength: 50 | The defined code of the accounttype, Examples: kontodebet, kontokredit, kontofaktura | |
accountAlias | string | Maxlength: 50 | A descriptive name for the account type, Examples: kontokredit1, matkonto1 | |
customerNo | string | Maxlength: 50 | Identifier of the customer (account owner) | |
status | string | Maxlength: 25 | Status of the account
| |
creditLimit | decimal | The creditlimit of the account, support patch operation but only lower | ||
unpaidBilledAmount | decimal | INTERN KOMMENTAR- total aktuell summa av alla balanser på BillingAcc (endast om negativ/skuld, annars 0) -INTERN KOMMENTAR | ||
debt | decimal | INTERN KOMMENTAR- total aktuell summa av alla balanser (kapital/ränta/avgifter osv.) på BillingAcc + underliggande CredAccs, OM NEGATIV (skuld) -INTERN KOMMENTAR | ||
surplus | decimal | INTERN KOMMENTAR- total aktuell summa av alla balanser (kapital/ränta/avgifter osv.) på BillingAcc + underliggande CredAccs, OM POSITIV (tillgodo) -INTERN KOMMENTAR | ||
reservedAmount | decimal | INTERN KOMMENTAR- Summerat belopp på alla utestående reservationer mot kontot (som är giltiga och ej captured) -INTERN KOMMENTAR | ||
availableAmount | decimal | INTERN KOMMENTAR- Tillgänglig kredit (kan ej räknas fram utifrån ovan belopp då avgifter kan ingå där, som inte påverkar tillgänglig kredit) -INTERN KOMMENTAR | ||
openBill.amount | decimal | The minimum amount to pay on the currently open bill | ||
openBill.bill | string | Uri | ||
openBill.dueDate | date | ISO 8601 | ||
openBill.billType | string | Maxlength: 25 | BillTypes:
| |
charityDonation | bool | If donations should be made from the account | ||
interestRate.debtInterest | decimal | Percentage | yearly debt interestrate | |
interestRate.penaltyInterest | decimal | Percentage | yearly penalty interestrate | |
offer | string | Uri | ||
directDebitConsent | string | Uri | ||
cards | string | Uri | ||
transactions | string | Uri | ||
currency | string | ISO 4217 | ||
bills | string | Uri | ||
customer | string | Uri |
Bills
List
Request
GET /ledger/credit-account/v1/XXX/accounts/123/bills HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"bills" : [
{ "billDate" : "2018-09-01", "status" : "open", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/963" },
{ "billDate" : "2018-08-01", "status" : "closed", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/852" },
{ "billDate" : "2018-07-01", "status" : "closed", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/741" }
]
}
Content-Type: application/json
{
"bills" : [
{ "billDate" : "2018-09-01", "status" : "open", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/963" },
{ "billDate" : "2018-08-01", "status" : "closed", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/852" },
{ "billDate" : "2018-07-01", "status" : "closed", "billAmount" : 374.10, "@id" : "/ledger/credit-account/v1/501/accounts/123456/bills/741" }
]
}
Resource
Request
GET /ledger/credit-account/v1/XXX/accounts/123/bills/456 HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "/ledger/credit-account/v1/501/accounts/123456/bills/124645",
"dueDate": "2018-12-05",
"billNo": "124645",
"amountToBePayed": 240.00,
"billType" : "Bill",
"bankPayment": {
"bankAccountNo": "123",
"bankAccountType": "BGSE",
"bic": "123456",
"iban": "SE12345678945631",
"paymentReference": "5465164654663"
},
"activeDirectDebitOrder": {
"paymentType": "AUTOGIRO",
"executionDate": "2019-01-01",
"amount" : 200.0
},
"pdf": "/ledger/credit-account/v1/501/accounts/123456/bills/963/pdf"
}
Content-Type: application/json
{
"@id": "/ledger/credit-account/v1/501/accounts/123456/bills/124645",
"dueDate": "2018-12-05",
"billNo": "124645",
"amountToBePayed": 240.00,
"billType" : "Bill",
"bankPayment": {
"bankAccountNo": "123",
"bankAccountType": "BGSE",
"bic": "123456",
"iban": "SE12345678945631",
"paymentReference": "5465164654663"
},
"activeDirectDebitOrder": {
"paymentType": "AUTOGIRO",
"executionDate": "2019-01-01",
"amount" : 200.0
},
"pdf": "/ledger/credit-account/v1/501/accounts/123456/bills/963/pdf"
}
Property | Data type | Format | Description |
---|---|---|---|
@id | string | Uri | |
dueDate | date | ISO 8601 | |
billNo | string | Maxlength: 50 | The identifier of the bill |
amountToBePayed | decimal | The minimum amount to pay on the currently open bill | |
billType | string | Maxlength: 25 | BillTypes:
|
bankPayment.bankAccountNo | string | Maxlength: 15 | |
bankPayment.bankAccountType | string | Maxlength: 10 | BankAccountTypes:
|
bankPayment.bic | string | Maxlength: 11 | |
bankPayment.iban | string | Maxlength: 34 | |
bankPayment.paymentReference | string | Maxlength: 50 | |
activePaymentOrder.paymentType | string | Maxlength: 15 | PaymentTypes:
|
activePaymentOrder.executionDate | date | ISO 8601 | Date when the paymentorder will be executed (when end-customer will be debited) |
activePaymentOrder.amount | decimal | INTERN KOMMENTAR - beroende på directdebittype så kan denna vara beräknad vid varje hämtning (utifrån ev. delbet) | |
string | Url | Url to download pdf |
Direct-debit
Request
POST /ledger/credit-account/v1/XXX/accounts/123/direct-debit HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id" : "/ledger/credit-account/v1/501/accounts/123456/direct-debit",
"directDebitType" : "fixedRecurring | totalDebt | billedAmount | onDemand",
"fixedRecurringAmount" : 1500.00,
"parentHREF": "/ledger/credit-account/v1/501/accounts/123456"
}
Content-Type: application/json
{
"@id" : "/ledger/credit-account/v1/501/accounts/123456/direct-debit",
"directDebitType" : "fixedRecurring | totalDebt | billedAmount | onDemand",
"fixedRecurringAmount" : 1500.00,
"parentHREF": "/ledger/credit-account/v1/501/accounts/123456"
}
Property | Data type | Format | Modify (patch) | Description |
---|---|---|---|---|
directDebitType | string | DirectDebitType:
| ||
fixedRecurringAmount | decimal | amount to monthly debit end-customers bankaccount (Only valid if directDebitType is fixedRecurring) |
Cards
List cards
Request
POST /ledger/credit-account/v1/XXX/accounts/123/cards HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"cards" : [
{"PanTrunc" : "85479**********648", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/741"},
{"PanTrunc" : "12345**********456", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/742"}
]
}
Content-Type: application/json
{
"cards" : [
{"PanTrunc" : "85479**********648", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/741"},
{"PanTrunc" : "12345**********456", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/742"}
]
}
Request
POST /ledger/credit-account/v1/XXX/accounts/123/cards/456 HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Get
Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"token": "954c8699-b38f-47a2-b568-668b8837dad8",
"PanTrunc": "85479*********648",
"deleted" : false,
"mainCard": true,
"cardHolder" : {
"number" : "123465",
"name": "test testsson",
"nationalConsumerIdentifier": {
"value": "19101010-1010",
"countryCode": "SE"
}
},
"@id": "/ledger/credit-account/v1/501/accounts/123456/cards/741",
"parentHREF": "/ledger/credit-account/v1/501/accounts/123456",
"operation" : [
{
"rel" : "partial-update",
"method" : "patch",
"href" : "/ledger/credit-account/v1/501/accounts/123456/cards/741"
}
]
}
Content-Type: application/json
{
"token": "954c8699-b38f-47a2-b568-668b8837dad8",
"PanTrunc": "85479*********648",
"deleted" : false,
"mainCard": true,
"cardHolder" : {
"number" : "123465",
"name": "test testsson",
"nationalConsumerIdentifier": {
"value": "19101010-1010",
"countryCode": "SE"
}
},
"@id": "/ledger/credit-account/v1/501/accounts/123456/cards/741",
"parentHREF": "/ledger/credit-account/v1/501/accounts/123456",
"operation" : [
{
"rel" : "partial-update",
"method" : "patch",
"href" : "/ledger/credit-account/v1/501/accounts/123456/cards/741"
}
]
}
Property | Data type | Format | Modify (patch) | Description |
---|---|---|---|---|
token | string | token identifier of the card | ||
panTrunc | string | truncated PAN | ||
deleted | bool | indicates wheter the card has been deleter | ||
mainCard | bool | indicated whether this card is the main card of the account (cardholder is always owner of account) | ||
cardHolder.number | string | Cardholder customernumber | ||
cardHolder.name | string | Cardholder fullname | ||
cardHolder.nationalConsumerIdentifier.value | string | YYYYMMDD-NNNC | ||
cardHolder.nationalConsumerIdentifier.countryCode | string | ISO 3166-1 alpha-2 |
Transactions
Request
POST /ledger/credit-account/v1/XXX/accounts/123/transactions HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"operations": null,
"items": [
{
"type": "payment",
"description": "",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": null
},
{
"type": "purchase",
"description": "testbutiken, köpref. 12345689",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": "2019-10-05",
},
{
"type": "credit",
"description": "",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": "2019-10-05"
}
],
"@id": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01",
"view": {
"@id": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01&$top=2&$skip=0",
"next": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01&$top=2&$skip=2"
}
}
Content-Type: application/json
{
"operations": null,
"items": [
{
"type": "payment",
"description": "",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": null
},
{
"type": "purchase",
"description": "testbutiken, köpref. 12345689",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": "2019-10-05",
},
{
"type": "credit",
"description": "",
"amount": 200.00,
"billed": false|true,
"date": "2019-10-09",
"reserveDate": "2019-10-05"
}
],
"@id": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01",
"view": {
"@id": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01&$top=2&$skip=0",
"next": "/ledger/credit-account/v1/501/accounts/123456/transactions?fromDate=2019-10-01&$top=2&$skip=2"
}
}
Property | Data type | Format | Description |
---|---|---|---|
type | string | (transactionTypeGroup) | |
description | string | ||
amount | decimal | ||
billed | bool | Indicates wheter a bill has been created after the transaction (ie. if the transaction is included in any bill or not) | |
date | date | INTERN KOMMENTAR - Valuedate |
Reservations
Request
POST /ledger/credit-account/v1/XXX/accounts/123/reservations HTTP/1.1
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Host: -
Authorization: Bearer <Token>
Content-Type: application/json
Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"operations": null,
"items": [
{
"amount": 200.00,
"description" : "",
"date": "2019-10-05",
},
{
"amount": 450.00,
"description" : "",
"date": "2019-10-02",
},
],
"@id": "/ledger/credit-account/v1/501/accounts/123456/reservations",
}
Content-Type: application/json
{
"operations": null,
"items": [
{
"amount": 200.00,
"description" : "",
"date": "2019-10-05",
},
{
"amount": 450.00,
"description" : "",
"date": "2019-10-02",
},
],
"@id": "/ledger/credit-account/v1/501/accounts/123456/reservations",
}
Property | Data type | Format | Description |
---|---|---|---|
amount | decimal | ||
description | string | ||
date | date |
Problems
If an error occur or any validation failed, a "problem" response will be returned.
Below is a list of problems that can occur:
HttpStatus 401 Unauthorized
- Token expired
- Token invalid
- SellerNumber does not match token
- CompanyNumber does not match token
HttpStatus 400 Error
- Validation: Argument required
- Validation: Invalid value
HttpStatus 422 Unprocessable entity
- Authorization declined
HttpStatus 409 Conflict
- Invoice already authorized
- Duplicate InvoiceNumber
- Authorization is cancelled
- Authorization already captured
- Authorization has expired
- Insufficient debited amount XXX
HttpStatus 501 NotImplemented
- CompanyNumber XXX not configured
- SellerNumber XXX not configured at PayEx
- CompanyNumber XXX missing configuration
HttpStatus 404 NotFound
- Authorization not found
Below is an example of a problem that will be returned if buyer.nationalConsumerIdentifier.value is not valid in the authorization post request.
Response
HTTP/1.1 400 Error
Content-Type: application/problem+json
{
"Type": "http://[DNS]/ledger/invoice-purchase/problems/validation",
"Title": "A validation error occurred",
"Status": 400,
"Instance": null,
"Detail": "A validation error occurred. Please fix the problems mentioned in the 'problems' property below.",
"Problems": [
{
"buyer.nationalConsumerIdentifier.value": "Not a valid SE nationalConsumerIdentifier"
}
]
}
Content-Type: application/problem+json
{
"Type": "http://[DNS]/ledger/invoice-purchase/problems/validation",
"Title": "A validation error occurred",
"Status": 400,
"Instance": null,
"Detail": "A validation error occurred. Please fix the problems mentioned in the 'problems' property below.",
"Problems": [
{
"buyer.nationalConsumerIdentifier.value": "Not a valid SE nationalConsumerIdentifier"
}
]
}