# Create Session for Invoice Order

This endpoint allows you to **export an order as an invoice** to **Front Payment Go**. Upon successful submission, it returns:

* **Order UUID**
* **Customer UUID**
* **Bank ID Verification URL** (for customer identity verification)

---

### Request

  - **Endpoint**: `https://demo-api.frontpayment.no/api/v1/connect/orders/invoice/submit`
  - **Method**: `POST`
  - **Authorization**: `Bearer <token>`


-----
#### Validation Rules
Ensure your payload adheres to the following validation rules:

<table>
  <thead>
    <tr>
      <th style="width: 270px;text-align:left;">Field</th>
      <th style="width: 80px;text-align:left;">Type</th>
      <th style="text-align:left;">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>products.*.name</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong>. The name of the product.</td>
    </tr>
    <tr>
      <td><code>products.*.productId</code></td>
      <td><code>string</code></td>
      <td><strong>Optional</strong>. The unique ID of the product.</td>
    </tr>
    <tr>
      <td><code>products.*.quantity</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>.  Quantity of the product.</td>
    </tr>
    <tr>
      <td><code>products.*.rate</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. Rate per unit of the product.</td>
    </tr>
    <tr>
      <td><code>products.*.discount</code></td>
      <td><code>numeric</code></td>
      <td><strong>Optional</strong>. Discount applied to the product.</td>
    </tr>
    <tr>
      <td><code>products.*.tax</code></td>
      <td><code>numeric</code></td>
      <td> <strong>Required</strong>. Tax rate must be (e.g., 0, 12, 15, 25), Unless you have other configuration unless otherwise configured.</td>
    </tr>
    <tr>
      <td><code>products.*.amount</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. Total amount for the product line item.</td>
    </tr>
    <tr>
      <td><code>orderSummary.subTotal</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. Subtotal of all products before tax and discount.</td>
    </tr>
    <tr>
      <td><code>orderSummary.totalTax</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. The total tax for the order.</td>
    </tr>
    <tr>
      <td><code>orderSummary.totalDiscount</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. Total discount for the order.</td>
    </tr>
    <tr>
      <td><code>orderSummary.grandTotal</code></td>
      <td><code>numeric</code></td>
      <td><strong>Required</strong>. Grand total of the order.</td>
    </tr>
    <tr>
      <td><code>orderDate</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong>. Unix timestamp for the Date of the order. </td>
    </tr>
    <tr>
      <td><code>referenceNo</code></td>
      <td><code>string</code></td>
      <td><strong>Optional</strong>. Any reference information from your side. example: Order Uuid generated from your application.</td>
    </tr>
    <tr>
      <td><code>customerReference</code></td>
      <td><code>string</code></td>
      <td><strong>Optional</strong>. Customer reference </td>
    </tr>
    <tr>
      <td><code>orderFrom</code></td>
      <td><code>string</code></td>
      <td><strong>Conditionally Required</strong> if <code>fpgoUuid</code> is present. If provided, the value must be <code>PARTNER</code>. This indicates that the request originates from a registered partner and is intended to update an existing record.</td>
    </tr>
    <tr>
      <td><code>fpgoUuid</code></td>
      <td><code>string</code></td>
      <td><strong>Optional</strong> Use this to <strong>prevent duplicates</strong>. Pass the <code>orderUuid</code> from a previous response to update that specific order. If omitted, a new order is created. </td>
    </tr>
    <tr>
      <td><code>invoiceInterval</code></td>
      <td><code>numeric</code></td>
      <td><strong>Optional</strong> Invoice interval (allowed: 0,1,2).</td>
    </tr>
    <tr>
      <td><code>separateInvoices</code></td>
      <td><code>boolean</code></td>
      <td><strong>Optional</strong> Whether invoices should be separated.</td>
    </tr>
    <tr>
      <td><code>invoiceFeeApplicable</code></td>
      <td><code>boolean</code></td>
      <td><strong>Required</strong> Whether invoice fee applies.</td>
    </tr>
    <tr>
      <td><code>invoiceMaturity</code></td>
      <td><code>numeric</code></td>
      <td><strong>Optional</strong> Invoice maturity period.</td>
    </tr>
    <tr>
      <td><code>settings.secureDetails</code></td>
      <td><code>boolean</code></td>
      <td><strong>Optional</strong> Enable secure details.</td>
    </tr>
    <tr>
      <td><code>customerDetails.type</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Customer type (<code>private</code> / <code>corporate</code>)</td>
    </tr>
    <tr>
      <td><code>customerDetails.countryCode</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Country code for the customer's phone number (e.g., "+47")</td>
    </tr>
    <tr>
      <td><code>customerDetails.msisdn</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Mobile Subscriber MSISDN Number (phone number).</td>
    </tr>
    <tr>
      <td><code>customerDetails.email</code></td>
      <td><code>email</code></td>
      <td><strong>Required</strong> Customer's email address.</td>
    </tr>
    <tr>
      <td><code>customerDetails.name</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Customer full name.</td>
    </tr>
    <tr>
      <td><code>customerDetails.personalNumber</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> if customer type is <code>private</code>. Customer's personal identification number, must be 11 characters.</td>
    </tr>
    <tr>
      <td><code>customerDetails.organizationId</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> if customer type is <code>corporate</code>. Must be alphanumeric.</td>
    </tr>
    <tr>
      <td><code>customerDetails.preferredLanguage</code></td>
      <td><code>string</code></td>
      <td><strong>Optional</strong> Customer preferred language. Available languages are <code>en</code> , <code>no</code> , <code>sv</code> , <code>da</code> , <code>de</code>. If nothing is given it will set default to <code>no</code>.</td>
    </tr>
    <tr>
      <td><code>customerDetails.address.street</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Street address of the customer.</td>
    </tr>
    <tr>
      <td><code>customerDetails.address.zip</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> Zip code of the customer's address.</td>
    </tr>
    <tr>
      <td><code>customerDetails.address.city</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> City of the customer's address.</td>
    </tr>
    <tr>
      <td><code>customerDetails.address.country</code></td>
      <td><code>string</code></td>
      <td><strong>Required</strong> ISO Alpha-2 country code (e.g., "NO"). Custom validation IsoAlpha2Country applies.</td>
    </tr>
    <tr>
      <td><code>callback.callbackUrl</code></td>
      <td><code>url</code></td>
      <td><strong>Required</strong> The URL to which Front Payment will send updates. Must be a valid url.</td>
    </tr>
    <tr>
      <td><code>callback.success</code></td>
      <td><code>url</code></td>
      <td><strong>Required</strong> The URL to redirect to upon successful payment. Must be a valid url.</td>
    </tr>
    <tr>
      <td><code>callback.failure</code></td>
      <td><code>url</code></td>
      <td><strong>Required</strong> The URL to redirect to upon failed payment. Must be a valid url.</td>
    </tr>
  </tbody>
</table>

---

### Example Request

```json
{
  "products": [
    {
      "name": "Router",
      "productId": "R_1",
      "quantity": "1",
      "rate": 40,
      "discount": 0,
      "tax": "0",
      "amount": 40
    }
  ],
  "orderSummary": {
    "subTotal": "40",
    "totalTax": "0",
    "totalDiscount": "0.00",
    "grandTotal": "40"
  },
  "orderDate": "1755150488",
  "customerDetails": {
    "type": "private",
    "countryCode": "+47",
    "msisdn": "46567468",
    "email": "zahid@yopmail.com",
    "name": "Zahidul",
    "preferredLanguage": "en",
    "personalNumber": "28038712383",
    "organizationId": "",
    "address": {
      "street": "Klosterenget 144",
      "zip": "7030",
      "city": "Trondheim",
      "country": "NO"
    }
  },
  "referenceNo": "Dhaka",
  "customerReference": "3500",
  "invoiceInterval": 0,
  "separateInvoices": true,
  "invoiceFeeApplicable": true,
  "invoiceMaturity": 10,
  "callback": {
    "callbackUrl": "https://wp.frontpayment.no/?order_identifier=rRbl1FWZG59o&order_status=success",
    "success": "https://wp.frontpayment.no/?order_identifier=rRbl1FWZG59o&order_status=success",
    "failure": "https://frontpayment.no/?order_identifier=rRbl1FWZG59o&order_status=failed"
  }
}
```

---

### Example Success Response

```json
{
  "status_code": 201,
  "status_message": "OK",
  "message": "orderCreatedSuccessfully",
  "is_data": true,
  "data": {
    "orderUuid": "ODR4286244937",
    "customerUuid": "CSRT3419523642",
    "bankIdUrl": "https://auth.current.bankid.no/precheck/auth?...state=eyJvcmRlclV1aWQiOiJPRFI0Mjg2MjQ0OTM3IiwiY29ubmVjdCI6InllcyJ9"
  }
}
```

---

### Other Responses

#### Internal Error (500)

```json
{
  "status_code": 500,
  "status_message": "Internal Dependency Error",
  "message": "Internal Error Occurred Please Try Again Later",
  "is_error": true,
  "errors": {
    "happenedAt": "String",
    "internalErrorDetails": "Array"
  }
}
```

#### Execution Exception (510)

```json
{
  "status_code": 510,
  "status_message": "Execution Exception Occurred",
  "message": "Something Went Wrong",
  "is_error": true,
  "errors": "Array"
}
```

### Notifications via Callback URL

[Go To `Notication Via Callback Url` Page](https://docs.frontpayment.no/books/fpgo-connect/page/notifications-via-callback-url)