Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required.
Spense Payment Management (v1)
Split the total gross amount of the payment into installments, which will be automatically debited at the specified dates.
Comments to be added to the invoice. These will be visible to the customer.
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.
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.
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.
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.
- Production API (legacy)https://api.spense.no/api/payments
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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"
}
}
]
}'{ "id": "1234567890abcdef12345678", "_links": { "gui": "/1234567890abcdef12345678", "longGui": "https://pay.spense.no/1234567890abcdef12345678" }, "installments": [ { … } ] }
- Production API (legacy)https://api.spense.no/api/payments/uploadDocument
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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={ "id": "string", "name": "string", "description": "string", "url": "string" }
- Production API (legacy)https://api.spense.no/api/payments/uploadDocument/{payflow_id}/{document_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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'{}
- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X DELETE \
'https://api.spense.no/api/payments/{payflow_id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'X-Organization-Id: string'{}
- Production API (legacy)https://api.spense.no/api/refund
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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": []
}'{ "refundType": "string", "debtorAccountNumber": "", "originalAmount": 0, "originalCurrency": "string", "grossRefundedAmount": 0, "netRefundedAmount": 0, "remainingAmount": 0, "refundId": "string" }
- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}/paymentStatus
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://api.spense.no/api/payments/{payflow_id}/paymentStatus' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'X-Organization-Id: string'{ "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": [] }
- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}/installments/create
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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"
}
]
}'{ "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" }
- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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'{ "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" }
- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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"
}
]
}'- Production API (legacy)https://api.spense.no/api/payments/{payflow_id}/installments/{installment_id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
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'- Production API (legacy)https://api.spense.no/legacy-payment-update
{ "id": "string", "paymentStatus": "DRAFT", "paymentMethod": "CARD", "installmentUpdate": { "installmentId": "string", "installmentStatus": "DRAFT" } }