CREATE Order
Important notes:
- In order to allow for patients to pay with saved credit cards and/or Payment Plans, we need to be able to tie to a patient.
- There are 2 ways of accomplishing this:
- Provide the patientId which is the iCorePay internal Patient ULID
- Provide your Patient ID (`externalPatientId`) AND Patient Date of birth `customerDOB`)
- externalPmsPatientId - This is the PMS's patient identifier
- externalPatientId - This is your identifier for the patient (can be the same as the PMS's patient identifer)
- customerDOB - In YYYY-MM-DD format.
- savePatient - Set to true to save patient info as a FeatherPay patient
- If externalPatientId exists, but is not in our DB from PMS, it will throw an error.
Create Order
From your backend code, create the order with your store id and private key.
POST
https://test-api.featherpay.io/v1/stores/{storeId}/orders
json
curl -X POST \
--url 'https://test-api.featherpay.io/api/v1/stores/:storeId/orders' \
--header 'content-type: application/json;charset=UTF-8' \
--header 'accept: application/json' \
--header 'X-Api-Key: {Secret API Key}' \
--header 'X-Store-Id: {Store ULID}' \
--data '{
"posOrderId": "Invoice Reference Id via API", //Your reference id for this invoice
"storeId": {Store ULID}, //Store ID we give you with keys for a given store
"totalInvoiced": 20000, // $200.00.
"patientId": "01F79XZZZZC2WKBZJ3XQ7Z1R64", // Optional. FeatherPay Patient Identifier
"externalPatientId": "abc123", // Optional. PMS Patient Identifier
"savePatient": false, // Set to true to save patient info using externalPatientId. FeatherPay will reply with the patientId to be used in future transactions
"customerDOB": "1959-10-22", // Required IF using externalPatientId. In format of `YYYY-MM-DD`
"customerEmail": "[email protected]",
"customerFirstName": "TERRENCE",
"customerLastName": "CLARKE",
"onBehalfOf": "[email protected]", //Identifier of merchant generating invoice. User readable format recommended, eg name or email
"enablePaymentPlanForPatient": true, // Optional. Default to store level if not specified
"shippingAddress": { // Optional
"firstName": "TERRENCE",
"lastName": "CLARKE",
"line1": "6110 WILMER RD",
"city": "CINCINNATI",
"stateProvince": "OH",
"postcode": "45247-5934",
"countryCode": "US",
"email": "[email protected]",
"telephone": "(513) 385-5591",
"sameAsBilling": false
},
"billingAddress": {
"firstName": "TERRENCE",
"lastName": "CLARKE",
"line1": "6110 WILMER RD",
"city": "CINCINNATI",
"stateProvince": "OH",
"postcode": "45247-5934",
"countryCode": "US",
"email": "[email protected]",
"telephone": "(513) 385-5591"
},
"orderItems": [
{
"quantity": 1,
"unitPrice": 10000, //$100.00
"name": "Dental procedure",
"sku": "D2740", // Code or unique identifier for product/service/procedure
"hidden": false, // Optional. If true, this will not be displayed to the patient.
"friendlyName": "Dental Fee", //Optional. If this field exists, it will be the display we show the customer at payment time.
"bundleId": "1", //Optional. If this field exists, it will group all items with the same bundle id together. Otherwise, the item will be treated as an individual line item
"externalPmsId":"10002347", //Optional. This is s a 3rd Party's identifer for a procedure
"pmsId": "23" //Optional. This is the PMS (OpenDental, EagleSoft, etc) identifier for a procedure
},
{
"quantity": 1,
"unitPrice": 10000,
"name": "cavityFilling",
"sku": "CavityFillingSKU1",
"hidden": false,
"friendlyName": "Cavity Filling",
"externalPmsId":"10002348",
"pmsId": "24"
}
],
"invoiceType": "{TextValue}" // Payment, Statement, or Unset used to trigger default payment reminders
}'200
{
"id": "01FDTFXZZ25GXZFWZZZYS1TJGT", //Need Order ID
"deleted": false,
"orderType": "quote",
"posOrderId": "Invoice Reference Id via API",
"storeId": "01E8F3ZZDJ186BZFZEN3V8Z44W",
"orderKey": "162HGY4R5H9RFBHMR1VZ2ZHW30", //Need Order Key
"status": "Incomplete",
"totalAuthorized": 0,
"totalCanceled": 0,
"totalInvoiced": 20000,
"totalPaid": 0,
"totalRefunded": 0,
"totalDue": 20000,
"patientId": "01F79XZZZZC2WKBZJ3XQ7Z1R64", //FeatherPay Internal Patient Identifier
"customerEmail": "[email protected]",
"customerFirstName": "TERRENCE",
"customerLastName": "CLARKE",
"onBehalfOf": "[email protected]",
"currencyCode": "usd",
"multipay": false,
"enablePaymentPlanForPatient": true,
"shippingAddress": {
"id": "01FDTEZVW6QSC9ZDXBSC02EFY7",
"orderId": "01FDTFXZZ25GXZFWZZZYS1TJGT",
"firstName": "TERRENCE",
"lastName": "CLARKE",
"line1": "6110 WILMER RD",
"city": "CINCINNATI",
"stateProvince": "OH",
"postcode": "45247-5934",
"countryCode": "US",
"email": "[email protected]",
"telephone": "(513) 385-5591",
"sameAsBilling": false,
"shipping": true,
"billing": false
},
"billingAddress": {
"id": "01FDTFDSTKFFZHZW6TJ7A882ZA",
"orderId": "01FDTFXZZ25GXZFWZZZYS1TJGT",
"firstName": "TERRENCE",
"lastName": "CLARKE",
"line1": "6110 WILMER RD",
"city": "CINCINNATI",
"stateProvince": "OH",
"postcode": "45247-5934",
"countryCode": "US",
"email": "[email protected]",
"telephone": "(513) 385-5591",
"sameAsBilling": false,
"shipping": false,
"billing": true
},
"orderItems": [
{
"id": "01FDTBFXWZ3K1VXSFZJDZ45JF5",
"orderId": "01FDTFXZZ25GXZFWZZZYS1TJGT",
"quantity": 1,
"unitPrice": 10000,
"name": "Dental procedure",
"sku": "34587549834",
"hidden": true,
"friendlyName": "Dental Fee",
"bundleId": "1",
"externalPmsId":"10002347",
"pmsId": "23"
},
{
"id": "01FDTEDXHPWFJNDBZQS8W743A4",
"orderId": "01FDTFXZZ25GXZFWZZZYS1TJGT",
"quantity": 1,
"unitPrice": 10000,
"name": "cavityFilling",
"sku": "CavityFillingSKU1",
"hidden": false,
"friendlyName": "Cavity Filling",
"externalPmsId":"10002348",
"pmsId": "24"
}
],
"invoiceType": "Payment"
}
400
{
"subErrors": [],
"status": "invalid_external_patient",
"message": "Cannot find patient with external ID of abc123 and DOB 1959-10-22"
}