POST Endpoint |
: |
https://demo-api.frontpayment.no/api/v1/connect/orders/invoice/create/faktura
Authentication
This endpoint requires a Bearer Token for authentication. You will need to obtain this token from Frontpayment and include it in the Authorization header of your request.
Example Authorization Header:
Authorization: Bearer YOUR_FRONTPAID_BEARER_TOKEN
Request Payload
The request body should be a JSON object containing details about the products, order and customer.
{
"products": {
"0": {
"name": "Hair Wash",
"productId": "VFDDF",
"quantity": "1",
"rate": 51,
"discount": 0,
"tax": "0",
"amount": 51
}
},
"orderSummary": {
"subTotal": "51.00",
"totalTax": "0.00",
"totalDiscount": "0.00",
"grandTotal": "51.00"
},
"orderDate": "5 Dec, 2023",
"dueDateForPaymentLink": "1703040812",
"sendOrderBy": {
"sms": false,
"email": false,
"invoice": true
},
"invoiceAsPaymentOption": false,
"isCreditCheckAvailable": false,
"customerDetails": {
"type": "private",
"countryCode": "+47",
"msisdn": "46567468",
"email": "[email protected]",
"customerUuid": "CSRT3672053467",
"name": "Kari Nordmann",
"preferredLanguage": "en",
"personalNumber": "12345678901,
"address": {
"street": "Luramyrveien 65",
"zip": "4313",
"city": "Sandnes",
"country": "NO"
}
},
"invoiceReferences": {
"referenceNo": "Dhaka",
"customerReference": "3500",
"receiptNo": "Cumilla",
"customerNotes": "NO",
"tnc": "adfsl"
},
"internalReferences": {
"referenceNo": "Dhaka",
"notes": "3500"
}
}
Validation Rules
Make sure your request meets the following requirements:
Field |
Type |
Description |
products.*.name |
required | string |
Required. Name of the product. |
Methodproducts.*.productId |
:nullable | string |
POSTNullable. Unique identifier for the product. |
Authorizationproducts.*.quantity |
:required | numeric |
BearerRequired. Quantity of the product. |
products.*.rate |
required | numeric |
Required. Rate per unit of the product. |
products.*.discount |
nullable | numeric |
Nullable. Discount applied to the product. |
products.*.tax |
required | numeric |
Required. Tax rate |
products.*.amount |
required | numeric |
Required. Total amount for the product line item. |
orderSummary.subTotal |
required | numeric |
Required. Subtotal of all products before tax and discount. |
orderSummary.totalTax |
required | numeric |
Required. Total tax for the order. |
orderSummary.totalDiscount |
required | numeric |
Required. Total discount for the order. |
orderSummary.grandTotal |
required | numeric |
Required. Grand total of the order. |
orderDate |
required | string |
Required. Unix timestamp for the Date of the order. |
dueDateForPaymentLink |
required | string |
Required. Unix timestamp for the due date of the payment link. |
Response
A successful request will return a 201 Created status with the following JSON payload:
{
"status_code": 201,
"status_message": "OK",
"message": "orderAddedSuccessfully",
"is_data": false,
"data": {
"uuid": "ODR3506777330",
"customerUuid": "CSRT3463048878"
}
}
API returns a 500 or 510 error, it means something failed on the server side
{
"status_code": 500,
"status_message": "Internal Dependency Error",
"message": "internalErrorOccurredPleaseTryAgainLater",
"is_error": true,
"errors": {
"happenedAt": "String",
"internalErrorDetails": "Array"
}
}
{
"status_code": 510,
"status_message": "Execution Exception Occurred",
"message": "somethingWentWrong",
"is_error": true,
"errors": "Array"
}
Payload Validations |
: |
'products.*.name' => 'required|string',
'products.*.productId' => 'nullable|string',
'products.*.quantity' => 'required|numeric',
'products.*.rate' => 'required|numeric',
'products.*.discount' => 'nullable|numeric',
'products.*.tax' => 'required|numeric',
'products.*.amount' => 'required|numeric',
'orderSummary.subTotal' => 'required|numeric',
'orderSummary.totalTax' => 'required|numeric',
'orderSummary.totalDiscount' => 'required|numeric',
'orderSummary.grandTotal' => 'required|numeric',
'orderDate' => 'required|string',
'dueDateForPaymentLink' => 'required|string',
'sendOrderBy.sms' => 'required|boolean',
'sendOrderBy.email' => 'required|boolean',
'sendOrderBy.invoice' => 'required|boolean',
'isCreditCheckAvailable' => 'required|boolean',
'invoiceAsPaymentOption' => 'required|boolean',
'customerDetails.customerUuid' => 'nullable|string',
'customerDetails.type' => 'required|nullable|string|in:private',
'customerDetails.countryCode' => 'required|nullable|string',
'customerDetails.msisdn' => 'required|nullable|string',
'customerDetails.email' => 'required|nullable|email',
'customerDetails.name' => 'required|string',
'customerDetails.preferredLanguage' => 'required|string',
'customerDetails.personalNumber' => 'required|string|size:11',
'customerDetails.address' => 'required|array',
'customerDetails.address.street' => 'required|string',
'customerDetails.address.zip' => 'required|string',
'customerDetails.address.city' => 'required|string',
'customerDetails.address.country' => 'required|string|in:ISO Alpha 2',
'invoiceReferences' => 'nullable|array',
'invoiceReferences.referenceNo' => 'nullable|string',
'invoiceReferences.customerReference' => 'nullable|string',
'invoiceReferences.receiptNo' => 'nullable|string',
'invoiceReferences.customerNotes' => 'nullable|string',
'invoiceReferences.tnc' => 'nullable|string',
'internalReferences' => 'nullable|array',
'internalReferences.referenceNo' => 'nullable|string',
'internalReferences.notes' => 'nullable|string'
|
Example Payload |
: |
{
"products": {
"0": {
"name": "Hair Wash",
"productId": "VFDDF",
"quantity": "1",
"rate": 51,
"discount": 0,
"tax": "0",
"amount": 51
}
},
"orderSummary": {
"subTotal": "51.00",
"totalTax": "0.00",
"totalDiscount": "0.00",
"grandTotal": "51.00"
},
"orderDate": "5 Dec, 2023",
"dueDateForPaymentLink": "1703040812",
"sendOrderBy": {
"sms": false,
"email": false,
"invoice": true
},
"invoiceAsPaymentOption": false,
"isCreditCheckAvailable": false,
"customerDetails": {
"type": "private",
"countryCode": "+47",
"msisdn": "46567468",
"email": "[email protected]",
"customerUuid": "CSRT3672053467",
"name": "Kari Nordmann",
"preferredLanguage": "en",
"personalNumber": "12345678901,
"address": {
"street": "Luramyrveien 65",
"zip": "4313",
"city": "Sandnes",
"country": "NO"
}
},
"invoiceReferences": {
"referenceNo": "Dhaka",
"customerReference": "3500",
"receiptNo": "Cumilla",
"customerNotes": "NO",
"tnc": "adfsl"
},
"internalReferences": {
"referenceNo": "Dhaka",
"notes": "3500"
}
}
|
Response Structure |
: |
{
"status_code": 201,
"status_message": "OK",
"message": "orderAddedSuccessfully",
"is_data": true,
"data": "Array"
}
{
"status_code": 500,
"status_message": "Internal Dependency Error",
"message": "internalErrorOccurredPleaseTryAgainLater",
"is_error": true,
"errors": {
"happenedAt": "String"
"internalErrorDetails": "Array"
}
}
{
"status_code": 510,
"status_message": "Execution Exception Occurred",
"message": "somethingWentWrong",
"is_error": true,
"errors": "Array"
}
|
Example Response |
: |
{
"status_code": 201,
"status_message": "OK",
"message": "orderAddedSuccessfully",
"is_data": false,
"data": {
"uuid": "ODR3506777330",
"customerUuid": "CSRT3463048878"
}
}
|
|