Skip to content

Create Payment

Request

Security
OAuth2ClientCredentials(Required scopes: organization:payflow:create)
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
orderobject(LegacyOrder)required
paymentobject(LegacyPayment)required
communicationobject(LegacyCommunication)
behaviourobject(LegacyBehaviour)
serviceAdvisorEmailstring or 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)
paymentMethodIdstring or 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
callbackobject(LegacyCallback)
supportFunctionsArray of any(Supportfunctions)
POST
/api/payments
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": "string",
        "countryCode": "string"
      },
      "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": "",
      "customerReference": "",
      "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.

installmentsArray of objects or null(Installments)
Any of:
Response
{ "id": "1234567890abcdef12345678", "_links": { "gui": "", "longGui": "" }, "installments": [ { … } ] }