# Create Payment Endpoint: POST /api/payments Version: v1 Security: OAuth2ClientCredentials ## Header parameters: - `X-Organization-Id` (string) Required if the account is part of multiple organizations. If the account only has access to one organization, this header is not required. ## Request fields (application/json): - `customer` (any, required) - `order` (object, required) - `order.orderNumber` (string) - `order.objects` (array) - `order.objects.type` (string, required) Enum: "", "newCar", "tradeInCAR" - `order.objects.numberPlate` (string) - `order.objects.brand` (string) - `order.objects.model` (string) - `order.objects.color` (string) - `order.objects.year` (string) - `order.objects.vinNumber` (string) - `payment` (object, required) - `payment.currency` (string) - `payment.totalGrossAmount` (number, required) - `payment.totalNetAmount` (number, required) - `payment.installments` (any) Split the total gross amount of the payment into installments, which will be automatically debited at the specified dates. - `payment.installmentsMode` (any) - `payment.items` (array) - `payment.items.description` (string) - `payment.items.grossUnitPrice` (number) - `payment.items.netUnitPrice` (number) - `payment.items.grossTotalPrice` (any) If set, this will override the total price calculated from grossUnitPrice * quantity. - `payment.items.netTotalPrice` (any) If set, this will override the total price calculated from netUnitPrice * quantity - `payment.items.vatAmount` (number) - `payment.items.quantity` (number) - `payment.items.taxRate` (number) The tax rate in percent, e.g. 25 for 25%% or 20.9 for 20.9% - `payment.items.discountRate` (number) - `payment.items.lineType` (string) Enum: "regular", "shipping", "part-sum" - `payment.dueDate` (string, required) - `payment.paymentRef` (string) - `payment.invoiceNumber` (string) - `payment.invoiceComments` (any) Comments to be added to the invoice. These will be visible to the customer. - `payment.profileId` (any) 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. - `payment.paymentDepartment` (any) 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. - `payment.internalRef` (string) - `payment.externalRef` (string) - `communication` (object) - `communication.send_payment_link` (boolean) - `communication.send_payment_reminder` (boolean) - `behaviour` (object) - `behaviour.redirectSuccessUrl` (any) If set, the user will be redirected to this URL after the payment is successful. - `behaviour.redirectCancelUrl` (any) If set, the user will be redirected to this URL after the payment is cancelled. A payment is cancelled if the user clicks the cancel button. - `behaviour.cancelButtonText` (string) Text for the cancel button, only visible if redirectCancelUrl is set. - `serviceAdvisorEmail` (any) 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. - `paymentMethodId` (any) 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. - `callback` (object) - `callback.status_update_url` (string) - `callback.terminal_failure_url` (string) - `callback.api_key` (any) - `callback.url` (string) - `supportFunctions` (array) ## Response 200 fields (application/json): - `id` (string, required) The ID of the payment, which is used to identify the payment in the system. - `_links` (object) - `_links.longGui` (string) The full URL of the payment link which is sent to the user. - `_links.gui` (string) The path of the payment link (without the domain). This property is deprecated and exists only to support legacy customer integrations. You should always use longGui. Specifically, if you combine the path provided in gui with a known Spense payment link domain (e. g. pay.spense.no), this might result in broken payment links or parts of the payflow functionality not working. One scenario where this can happen is when Spense has configured a custom payment link domain for the affected organization. longGui will always use the payment link domain that is configured at the time of payment creation. - `installments` (any) ## Response 422 fields (application/json): - `detail` (array) - `detail.loc` (array, required) - `detail.msg` (string, required) - `detail.type` (string, required)