Skip to content

Spense Payment Management (v1)

Languages
Servers
Production API (legacy)
https://api.spense.no/

Create Payment

Request

Security
OAuth2ClientCredentials
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

Bodyapplication/jsonrequired
customerany(Customer)required
customer.​emailEmail (string) or Email (null)(Email)
Default ""
Any of:
string(Email)
Default ""
customer.​phoneobject(LegacyPhoneNumber)
Default {"countryCode":"","number":""}
customer.​organizationNamestring(Organizationname)
Default ""
customer.​organizationNumberstring(Organizationnumber)
Default ""
customer.​customerNumberstring(Customernumber)
Default ""
customer.​billingAddressobject(LegacyAddress)
Default {"careOf":"","street":"","secondary":"","postalCode":"","city":"","country":""}
customer.​typestring(Type)
Default "organization"
Value"organization"
Discriminator
Value "organization"
orderobject(LegacyOrder)required
order.​orderNumberstring(Ordernumber)
Default ""
order.​objectsArray of objects(Objects)
Default []
paymentobject(LegacyPayment)required
payment.​currencystring(Currency)
Default ""
payment.​totalGrossAmountnumber(Totalgrossamount)> 0required
payment.​totalNetAmountnumber(Totalnetamount)> 0required
payment.​installmentsArray of Installments (objects) or Installments (null)(Installments)
Any of:

Split the total gross amount of the payment into installments, which will be automatically debited at the specified dates.

payment.​installmentsModeInstallmentsMode (string) or null
Any of:
string InstallmentsMode Recursive
payment.​itemsArray of objects(Items)
Default []
payment.​dueDatestring(date)(Duedate)required
payment.​paymentRefstring(Paymentref)
Default ""
payment.​invoiceNumberstring(Invoicenumber)
Default ""
payment.​invoiceCommentsInvoicecomments (string) or Invoicecomments (null)(Invoicecomments)
Any of:

Comments to be added to the invoice. These will be visible to the customer.

string(Invoicecomments)
payment.​profileIdProfileid (string) or Profileid (null)(Profileid)
Any of:

The ID of the payment profile that the payment shall be created for. If the organization has two or more payment profiles, either profileId or paymentDepartment must be specified. We highly recommend to always specify either profileId or paymentDepartment.

string(Profileid)^[a-fA-F0-9]{24}$
payment.​paymentDepartmentPaymentDepartment (string) or null
Any of:

This field can be used as a simpler alternative for specifying the payment profile that the payment shall be created for. If profileId is not specified and the organization has a payment profile for the department which is specified in paymentDepartment, that payment profile will be used. If the organization has two or more payment profiles, either profileId or paymentDepartment must be specified. We highly recommend to always specify either profileId or paymentDepartment.

string PaymentDepartment Recursive
payment.​internalRefstring(Internalref)
Default ""
payment.​externalRefstring(Externalref)
Default ""
communicationobject(LegacyCommunication)
behaviourobject(LegacyBehaviour)
serviceAdvisorEmailServiceadvisoremail (string) or Serviceadvisoremail (null)(Serviceadvisoremail)
Any of:

Can be set to describe which user in the remote ERP system that created the payment or order, this is helpful for reporting purposes and if the user also have access to the Spense platform the payment will be attached to this user. If the user does not have an account, a user with no roles or access will be created.

string(email)(Serviceadvisoremail)
paymentMethodIdPaymentmethodid (string) or Paymentmethodid (null)(Paymentmethodid)
Any of:

New field added 2024-08-27. Use the partner API to fetch a list of payment methods. Sending null here will rely on the default payment method (standard way of creating payments). A payment method can be anything, for example a terminal, invoice, payment link or any other future types of payments that may be implemented.

string(Paymentmethodid)^[a-fA-F0-9]{24}$
callbackobject(LegacyCallback)
supportFunctionsArray of LegacySupportFunctionSharebox (object) or LegacySupportFunctionKeybox (object)(Supportfunctions)
curl -i -X POST \
  https://api.spense.no/api/payments \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'X-Organization-Id: string' \
  -d '{
    "customer": {
      "email": "",
      "phone": {
        "countryCode": "",
        "number": ""
      },
      "firstName": "",
      "lastName": "",
      "customerNumber": "",
      "billingAddress": {
        "careOf": "",
        "street": "",
        "secondary": "",
        "postalCode": "",
        "city": "",
        "country": ""
      },
      "type": "person"
    },
    "order": {
      "orderNumber": "",
      "objects": []
    },
    "payment": {
      "currency": "",
      "totalGrossAmount": 0,
      "totalNetAmount": 0,
      "installments": [
        {
          "date": "2019-08-24",
          "grossAmount": 0,
          "items": [
            {
              "description": "",
              "grossUnitPrice": 0,
              "netUnitPrice": 0,
              "grossTotalPrice": 0,
              "netTotalPrice": 0,
              "vatAmount": 0,
              "quantity": 0,
              "taxRate": 0,
              "discountRate": 0,
              "lineType": "regular"
            }
          ]
        }
      ],
      "installmentsMode": "pay-down",
      "items": [],
      "dueDate": "2019-08-24",
      "paymentRef": "",
      "invoiceNumber": "",
      "invoiceComments": "string",
      "profileId": "string",
      "paymentDepartment": "UNKNOWN",
      "internalRef": "",
      "externalRef": ""
    },
    "communication": {
      "send_payment_link": true,
      "send_payment_reminder": true
    },
    "behaviour": {
      "redirectSuccessUrl": "http://example.com",
      "redirectCancelUrl": "http://example.com",
      "cancelButtonText": "Cancel"
    },
    "serviceAdvisorEmail": "user@example.com",
    "paymentMethodId": "string",
    "callback": {
      "url": "",
      "status_update_url": "",
      "terminal_failure_url": "",
      "api_key": "string"
    },
    "supportFunctions": [
      {
        "sharebox": {
          "useSharebox": false,
          "plateNumber": "string"
        }
      }
    ]
  }'

Responses

Successful Response

Bodyapplication/json
idstring(Id)required

The ID of the payment, which is used to identify the payment in the system.

_linksobject(LegacyPaymentLinksResponse)
Default {"gui":"","longGui":""}
installmentsArray of Installments (objects) or Installments (null)(Installments)
Any of:
Response
application/json
{ "id": "1234567890abcdef12345678", "_links": { "gui": "/1234567890abcdef12345678", "longGui": "https://pay.spense.no/1234567890abcdef12345678" }, "installments": [ {} ] }

Upload Document

Request

Security
OAuth2ClientCredentials
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

Bodymultipart/form-datarequired
idId (string)(Id)required
Any of:
string(Id)^[a-fA-F0-9]{24}$
filestring(binary)(File)required
namestring(Name)
Default ""
descriptionstring(Description)
Default ""
curl -i -X POST \
  https://api.spense.no/api/payments/uploadDocument \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: multipart/form-data' \
  -H 'X-Organization-Id: string' \
  -F id=string \
  -F file=string \
  -F name= \
  -F description=

Responses

Successful Response

Bodyapplication/json
idstring(Id)^[a-fA-F0-9]{24}$required
namestring(Name)required
descriptionstring(Description)required
urlstring(Url)required
Response
application/json
{ "id": "string", "name": "string", "description": "string", "url": "string" }

Delete Document

Request

Security
OAuth2ClientCredentials
Path
payflow_idPayflow Id (string)(Payflow Id)required
Any of:
string(Payflow Id)^[a-fA-F0-9]{24}$
document_idstring(Document Id)^[a-fA-F0-9]{24}$required
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

curl -i -X DELETE \
  'https://api.spense.no/api/payments/uploadDocument/{payflow_id}/{document_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Organization-Id: string'

Responses

Successful Response

Bodyapplication/json
object(Response Delete Document)
Response
application/json
{}

Delete Payment

Request

Security
OAuth2ClientCredentials
Path
payflow_idPayflow Id (string)(Payflow Id)required
Any of:
string(Payflow Id)^[a-fA-F0-9]{24}$
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

curl -i -X DELETE \
  'https://api.spense.no/api/payments/{payflow_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Organization-Id: string'

Responses

Successful Response

Bodyapplication/json
object(Response Delete Payment)
Response
application/json
{}

Refund Payment

Request

Security
OAuth2ClientCredentials
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

Bodyapplication/jsonrequired
crossPaymentCrosspayment (string)(Crosspayment)required
Any of:
string(Crosspayment)^[a-fA-F0-9]{24}$
currencystring(Currency)required
totalGrossAmountnumber(Totalgrossamount)required
totalNetAmountnumber(Totalnetamount)required
invoiceLinesArray of objects(Invoicelines)
Default []
curl -i -X POST \
  https://api.spense.no/api/refund \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'X-Organization-Id: string' \
  -d '{
    "crossPayment": "string",
    "currency": "string",
    "totalGrossAmount": 0,
    "totalNetAmount": 0,
    "invoiceLines": []
  }'

Responses

Successful Response

Bodyapplication/json
refundTypestring(Refundtype)required
debtorAccountNumberstring(Debtoraccountnumber)
Default ""
originalAmountnumber(Originalamount)required
originalCurrencystring(Originalcurrency)required
grossRefundedAmountnumber(Grossrefundedamount)required
netRefundedAmountnumber(Netrefundedamount)required
remainingAmountRemainingamount (number) or Remainingamount (null)(Remainingamount)required
Any of:
number(Remainingamount)
refundIdstring(Refundid)required
Response
application/json
{ "refundType": "string", "debtorAccountNumber": "", "originalAmount": 0, "originalCurrency": "string", "grossRefundedAmount": 0, "netRefundedAmount": 0, "remainingAmount": 0, "refundId": "string" }

Get Payment Status

Request

Security
OAuth2ClientCredentials
Path
payflow_idPayflow Id (string)(Payflow Id)required
Any of:
string(Payflow Id)^[a-fA-F0-9]{24}$
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

curl -i -X GET \
  'https://api.spense.no/api/payments/{payflow_id}/paymentStatus' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Organization-Id: string'

Responses

Successful Response

Bodyapplication/json
totalAmountnumber(Totalamount)required
installmentsArray of Installments (objects) or Installments (null)(Installments)
Any of:
paymentIdstring(Paymentid)^[a-fA-F0-9]{24}$required
paymentNumberinteger(Paymentnumber)required
paymentStatusobject(Status)required
paymentStatus.​paymentStatusstring(PayflowLegacyStatus)required
Enum"DRAFT""OPENED""INITIATED""PENDING""SUCCESS""REJECTED""UNKNOWN"
merchantIdstring(Merchantid)required
createdAtstring(date-time)(Createdat)required
dueDateDuedate (string) or Duedate (null)(Duedate)required
Any of:
string(date-time)(Duedate)
filesArray of objects(Files)
Default []
Response
application/json
{ "totalAmount": 0, "installments": [ {} ], "paymentId": "string", "paymentNumber": 0, "paymentStatus": { "paymentStatus": "DRAFT" }, "merchantId": "string", "createdAt": "2019-08-24T14:15:22Z", "dueDate": "2019-08-24T14:15:22Z", "files": [] }

Create Installment

Request

Security
OAuth2ClientCredentials
Path
payflow_idstring(Payflow Id)^[a-fA-F0-9]{24}$required
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

Bodyapplication/jsonrequired
datestring(date)(Date)required
grossAmountnumber(Grossamount)> 0required
itemsArray of objects(Items)
curl -i -X POST \
  'https://api.spense.no/api/payments/{payflow_id}/installments/create' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'X-Organization-Id: string' \
  -d '{
    "date": "2019-08-24",
    "grossAmount": 0,
    "items": [
      {
        "description": "",
        "grossUnitPrice": 0,
        "netUnitPrice": 0,
        "grossTotalPrice": 0,
        "netTotalPrice": 0,
        "vatAmount": 0,
        "quantity": 0,
        "taxRate": 0,
        "discountRate": 0,
        "lineType": "regular"
      }
    ]
  }'

Responses

Successful Response

Bodyapplication/json
idstring(Id)required
datestring(date)(Date)required
typestring(Type)required
Enum"initial""scheduled"
grossAmountnumber(Grossamount)required
statusstring(PaymentStatus)required
Enum"DRAFT""CREATED""SENT""OPENED""FAILED""PENDING""PAID""CANCELLED"
numTriedinteger(Numtried)required
successfullyChargedAtSuccessfullychargedat (string) or Successfullychargedat (null)(Successfullychargedat)required
Any of:
string(date-time)(Successfullychargedat)
numFailedinteger(Numfailed)required
lastFailedAtLastfailedat (string) or Lastfailedat (null)(Lastfailedat)required
Any of:
string(date-time)(Lastfailedat)
Response
application/json
{ "id": "string", "date": "2019-08-24", "type": "initial", "grossAmount": 0, "status": "DRAFT", "numTried": 0, "successfullyChargedAt": "2019-08-24T14:15:22Z", "numFailed": 0, "lastFailedAt": "2019-08-24T14:15:22Z" }

Get Installment

Request

Security
OAuth2ClientCredentials
Path
payflow_idstring(Payflow Id)^[a-fA-F0-9]{24}$required
installment_idstring(Installment Id)^[a-fA-F0-9]{24}$required
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

curl -i -X GET \
  'https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Organization-Id: string'

Responses

Successful Response

Bodyapplication/json
idstring(Id)required
datestring(date)(Date)required
typestring(Type)required
Enum"initial""scheduled"
grossAmountnumber(Grossamount)required
statusstring(PaymentStatus)required
Enum"DRAFT""CREATED""SENT""OPENED""FAILED""PENDING""PAID""CANCELLED"
numTriedinteger(Numtried)required
successfullyChargedAtSuccessfullychargedat (string) or Successfullychargedat (null)(Successfullychargedat)required
Any of:
string(date-time)(Successfullychargedat)
numFailedinteger(Numfailed)required
lastFailedAtLastfailedat (string) or Lastfailedat (null)(Lastfailedat)required
Any of:
string(date-time)(Lastfailedat)
Response
application/json
{ "id": "string", "date": "2019-08-24", "type": "initial", "grossAmount": 0, "status": "DRAFT", "numTried": 0, "successfullyChargedAt": "2019-08-24T14:15:22Z", "numFailed": 0, "lastFailedAt": "2019-08-24T14:15:22Z" }

Update Installment

Request

Security
OAuth2ClientCredentials
Path
payflow_idstring(Payflow Id)^[a-fA-F0-9]{24}$required
installment_idstring(Installment Id)^[a-fA-F0-9]{24}$required
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

Bodyapplication/jsonrequired
grossAmountnumber(Grossamount)> 0required
itemsArray of objects(Items)
curl -i -X PUT \
  'https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'X-Organization-Id: string' \
  -d '{
    "grossAmount": 0,
    "items": [
      {
        "description": "",
        "grossUnitPrice": 0,
        "netUnitPrice": 0,
        "grossTotalPrice": 0,
        "netTotalPrice": 0,
        "vatAmount": 0,
        "quantity": 0,
        "taxRate": 0,
        "discountRate": 0,
        "lineType": "regular"
      }
    ]
  }'

Responses

Successful Response

Bodyapplication/json
any
Response
application/json
null

Delete Installment

Request

Security
OAuth2ClientCredentials
Path
payflow_idstring(Payflow Id)^[a-fA-F0-9]{24}$required
installment_idstring(Installment Id)^[a-fA-F0-9]{24}$required
Headers
X-Organization-Idstring(X-Organization-Id)

Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.

curl -i -X DELETE \
  'https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Organization-Id: string'

Responses

Successful Response

Bodyapplication/json
any
Response
application/json
null

Webhooks

Webhooks