e-Commerce API
The e-Commerce API provides functions for e-Commerce partners.
Communication Overview
sequenceDiagram
participant BI UI as Biller UI
participant BI BE as Biller Backend
participant HI UI as HICAPS UI
participant HI BE as HICAPS Backend
note over BI UI, HI BE: Ecommerce APIs
BI UI-->>+BI UI: User clicks Pay with HICAPS
BI UI-->>+BI BE: Basket ID x wants to pay <Br>with HICAPS
BI BE->>+HI BE: (1) POST: Session request
HI BE->>+BI BE: (2) Sync response: Session ID
BI BE-->>+BI UI: Session ID
BI UI-->>+HI UI: Redirect (URL incl. Session ID)
HI UI-->>+HI BE: Check Session ID
HI UI-->>+HI UI: User enters fund member data
HI UI-->>+HI UI: User enters credit card details <br>(if needed)
HI BE->>+BI BE: (3) Webhook: result (on success)
HI UI-->>+BI UI: Redirect to ReturnURL
BI BE-->>+BI UI: Result
note over BI UI, HI BE: Backoffice API
BI BE->>+HI BE: (4) Cancel-request
note over BI UI, HI BE: Admin API
BI BE->>+HI BE: (5) Create webhook subscription
BI BE->>+HI BE: (6) Delete webhook subscription
Authentication
Standard OAuth 2.0 Authentication
client_credentials : client_id and client_secret
Note:
Separate set of credentials required for
(1) Session request and
(4) Refund request
Sessions
This resource allows to create a customer session for paying basket items using a combination of health fund and card.
Create Session
POST /billers/{billerId}/sessions
Authorization : Basic Base64Encoded(Hicaps_Client_Id, Hicaps_Client_Secret)
Path Parameters
Field | Format | Required? | Description |
---|---|---|---|
billerId |
UUID | Mandatory | HICAPS’s unique reference for the Biller. |
Session request body parameters
Field | Format | Required? | Description |
---|---|---|---|
id |
string | Mandatory | Unique identifier of the request. |
returnUrlFailure |
string | Mandatory | The URL where the customer will be redirected to on payment failure. |
returnUrlSuccess |
string | Mandatory | The URL where the customer will be redirected to on payment success. |
basketInformation |
basketInformation object |
Mandatory |
BasketInformation parameters
Field | Format | Required? | Description |
---|---|---|---|
reference |
string | Mandatory | Reference of the basket. Also known as order number. |
created |
dateTime YYYY-MM-DDTHH:mm:ss.SSS±HH:mm | Mandatory | dateTime of the creation of the basket. |
totalAmount |
decimal (2 dp) | Mandatory | Total amount of the basket / order including shipping. |
member |
member object |
Mandatory | Customer information for the purpose to pre-fill fields. Given the customer choses HICAPS, they intend to pay with a health fund, which they are a ‘member’ of. |
items |
list of item objects |
Mandatory | Items of the basket/order. |
shipping |
shipping object |
Optional | Shipping component, assumed no shipping has been charged if not provided. |
Member parameters
Field | Format | Required? | Description |
---|---|---|---|
fund |
string | Optional | Code of the private health fund (aka program). |
id |
string | Optional | Member number with the health fund. Also known as memberNumber. |
givenName |
string | Optional | The member’s first name. Used to prefill card holder in case customer pays gap with a card. |
familyName |
string | Optional | The member’s last name. Used to prefill card holder in case customer pays gap with a card. |
billingAddress |
billingAddress object |
Mandatory | The member’s address. Used to prefill address fields in case customer pays gap with card and address required. |
BillingAddress parameters
Field | Format | Required? | Description |
---|---|---|---|
lines |
list of strings | Mandatory | Each line of the street address is a separate string. |
city |
string | Mandatory | The city of the customer billing address. |
postalCode |
string | Mandatory | The post code of the customer billing address. |
state |
string | Mandatory | The state of the customer billing address. |
country |
string | Mandatory | The country of the customer billing address. |
Item parameters
Field | Format | Required? | Description |
---|---|---|---|
billerItemId |
string | Mandatory | this line item in the basket/order. Ideally unique. |
itemPublisher |
string | Mandatory | Publisher of the item code. E.g. MBS for Medicare Benefits Schedule |
itemCode |
string | Mandatory | The unique identifier of the service or good. Unique within the publisher’s items list. This value is relevant for the private health insurance claim. |
description |
string | Mandatory | Description of the item or service, which is displayed to the customer. |
unitPrice |
decimal (2 dp) | Net price per unit including tax. Discounted amount has already been applied. | |
discountAmount |
decimal (2 dp) | Optional | Discount amount which is already reflected in the unit price of this item. |
quantity |
decimal (4 dp) | Mandatory | Quantity of items. |
Shipping parameters
Field | Format | Required? | Description |
---|---|---|---|
description |
string | Optional | Description of the shipping component. |
amount |
decimal (2 dp) | Mandatory | Total amount for shipping and handling for the whole basket / order. |
Example Create session request
{
"id": "42592fdd-2fd9-4a5b-a861-3ad374a158ea",
"returnUrlFailure": "https://biller-endpoint/failure",
"returnUrlSuccess": "https://biller-endpoint/success",
"basketInformation": {
"reference": "3371_9786729",
"created": "2023-06-14T06:54:06.532Z",
"totalAmount": 98,
"member": {
"fund": "nib",
"id": null,
"givenName": "Genesis",
"familyName": "Mason",
"billingAddress": {
"lines": [
"2 Carrington Street"
],
"city": "Sydney",
"postalCode": "2000",
"state": "NSW",
"country": "Australia"
}
},
"items": [
{
"billerItemId": "1",
"itemPublisher": "pbs",
"itemCode": "851",
"description": "Right: Easyvision Umere Multifocal",
"unitPrice": 30,
"discountAmount": 5,
"quantity": 1
},
{
"billerItemId": "2",
"itemPublisher": "pbs",
"itemCode": "851",
"description": "Left: Easyvision Umere Multifocal",
"unitPrice": 30,
"discountAmount": 5,
"quantity": 2
}
],
"shipping": {
"description": "AusPost standard shipping with tracking",
"amount": 8.00
}
}
}
Reponse from POST: Session Request HTTP 201
TimeStamp in Unix Epoch Time
session timeout 30 mins
→ on timeout, HICAPS to redirect back to returnUrlFailure. No webhook sent in this case.
{
"sessionId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"expiresAt": 1678234565
}
PaymentResult webhook
Sent when customer has completed a purchase (full basket paid by fund and/or card).
A completed (=fully paid) session sessionId will become the basketId.
So you will expect the basketId to be equal to the original request sessionId.
A completed session or a completed basket means a basket that has been fully paid (by card transaction and/or fund benefits).
webhook Body parameters
Field | Format | Required? | Description |
---|---|---|---|
id |
list of strings | Mandatory | Unique identifier of the webhook. |
created |
string | Mandatory | Time stamp of the webhook. |
type |
“paymentResult” | Mandatory | |
data |
data object |
Mandatory |
data parameters
Field | Format | Required? | Description |
---|---|---|---|
basketId |
string | Mandatory | Unique identifier. Generated by HICAPS. It is the sessionId of the session for a completed basket (total amount of the basket is paid). |
reference |
string | Mandatory | Reference from the original sessionRequest. |
invoiceId |
string | Optional | Unique identifier of the PHI invoice. Only available when a PHI claim has occurred. |
billerId |
string | Mandatory | Unique identifier of the biller. |
operation |
string = “payment” | Mandatory | Net price per unit including tax. Discounted amount has already been applied. |
success |
boolean | Mandatory | =“true”. |
totalAmountPaid |
decimal (2 dp) | Mandatory | Total amount paid through PHI claim and/or card. |
paymentDetails |
list of paymentObjects | Mandatory | Information about how the total amount was paid. |
itemStatuses |
list of ItemStatuses | Mandatory | List of individual unit items with their adjudication status. There will be as many elements in this array as the sum of each item quantity in the original basket. |
paymentObject parameters
Field | Format | Required? | Description |
---|---|---|---|
paidUsing |
“card” or “fund” | Mandatory | Indicate how this object amount was paid. |
amount |
string | Mandatory | Amount successfully paid. |
details |
string | Optional | Additional information. Contains funds name in the case of paidUsing Health Fund payment. |
itemStatuses parameters
Field | Format | Required? | Description |
---|---|---|---|
itemId |
string | Mandatory | Unique identifier of the webhook. |
billerItemId |
string | Mandatory | Time stamp of the webhook. |
benefit |
decimal (2 dp) | Mandatory | |
gap |
decimal (2 dp) | Mandatory | |
adjudications |
list of strings | Optional | Information about funds adjudications. |
invalidParams |
list of strings | Optional | Invalid claim parameters description. |
Note about the itemIds and billerItemids
Each item in the original basket is identified by the billerItemId
provided during the session creation request. This item may have a quantity > 1. To claim to the fund and to enable partial refund, each original item will be split in as many items as its quantity.
An itemId
will be attributed to each individual unit.
The aggregated item (quantity > 1) can still be identified by looking for all items with the same billerItemId
.
For example, if a basket has the following item:
{
"billerItemId": "2",
"itemPublisher": "pbs",
"itemCode": "851",
"description": "Left: Easyvision Umere Multifocal",
"unitPrice": 30,
"discountAmount": 5,
"quantity": 2
}
There will be 2 itemStatuses, each with a separate itemId in the paymentResult webhook:
"itemStatuses": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "2",
"benefit": 30,
"gap": 0
},
{
"itemId": "2229c9c5-500d-4636-9237-976798834aa1",
"billerItemId": "2",
"benefit": 20,
"gap":10,
"adjudications" : ["Customer has reached the limit..."]
}
],
PaymentResult: PHI and card funded
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "paymentResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "payment",
"success": true,
"totalAmountPaid": 98,
"paymentDetails": [
{
"paidUsing": "fund",
"details": "BUPA",
"amount": 80
},
{
"paidUsing": "card",
"details": "",
"amount": 18
}
],
"itemStatuses": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"benefit": 30,
"gap": 0
},
{
"itemId": "2229c9c5-500d-4636-9237-976798834aa1",
"billerItemId": "2",
"benefit": 50,
"gap":0
}
],
"shipping": {
"amount": 18.00
}
}
}
PaymentResult: 100% PHI funded
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "paymentResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "payment",
"success": true,
"totalAmountPaid": 80,
"paymentDetails": [
{
"paidUsing": "fund",
"details": "BUPA",
"amount": 80
}
],
"itemStatuses": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"benefit": 30,
"gap": 0
},
{
"itemId": "2229c9c5-500d-4636-9237-976798834aa1",
"billerItemId": "2",
"benefit": 50,
"gap":0
}
],
"shipping": {
"amount": 0
}
}
}
PaymentResult: 100% Card funded
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "paymentResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"reference": "3371_9786729",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "payment",
"success": true,
"totalAmountPaid": 98.0,
"paymentDetails": [
{
"paidUsing": "card",
"details": "",
"amount": 98
}
],
"itemStatuses": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"benefit": 0,
"gap": 30,
"adjudications" : [ "No more benefit allocated for this item ..."]
},
{
"itemId": "2229c9c5-500d-4636-9237-976798834aa1",
"billerItemId": "2",
"benefit": 0,
"gap":50,
"invalidParams" : [ "Item Code : Invalid Item code 879" ]
}
],
"shipping": {
"amount": 18
}
}
}
Refund request
POST /billers/{billerId}/baskets/{basketId}/refund
Path Parameters
Field | Format | Required? | Description |
---|---|---|---|
billerId |
UUID | Mandatory | Unique identifier of the biller. |
basketId |
UUID | Mandatory | Unique identifier of the paid basket to be refunded. |
Body parameters
Field | Format | Required? | Description |
---|---|---|---|
items |
list of itemId s (strings) |
Mandatory | ItemIds (units of a particular billerItem in the basket) that shall be refunded. |
reason |
string | Optional | Optional text. |
refundShipping |
bool | Mandatory | Indicates whether to refund shipping or not. |
Refund request response
Refund Request response is asynchronous (202), and will provide a refundId.
{
"refundId": "a6991677-9928-48fe-bb3d-5fa5b41d1fba"
}
Sample refund requests body
Assuming the following initial PaymentResult webhook:
{
"itemStatuses": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"benefit": 30,
"gap": 0
},
{
"itemId": "2229c9c5-500d-4636-9237-976798834aa1",
"billerItemId": "2",
"benefit": 50,
"gap":0
},
{
"itemId": "6864fc32-058a-42b3-95a7-791d96976a62",
"billerItemId": "2",
"benefit": 25,
"gap":25,
"adjudications" : [ "Benefit exhausted..." ]
}
],
"shipping": {
"amount": 18
}
}
Requesting a Full refund inclusive shipping
{
"items": [
"1111ce18-bb10-4390-af84-3a2c56e2dc44",
"2229c9c5-500d-4636-9237-976798834aa1",
"6864fc32-058a-42b3-95a7-791d96976a62" ],
"refundShipping" : true
}
Requesting a Full refund exclusive shipping
As an example a refund reason has also been provided.
{
"items": [
"1111ce18-bb10-4390-af84-3a2c56e2dc44",
"2229c9c5-500d-4636-9237-976798834aa1",
"6864fc32-058a-42b3-95a7-791d96976a62" ],
"refundShipping" : false,
"reason": "Customer accidentally ordered three boxes for their left eye"
}
Requesting a partial refund
Items contains only those items that shall be refunded
{
"items": [ "2229c9c5-500d-4636-9237-976798834aa1"],
"refundShipping" : false,
"reason": "Customer accidentally ordered two boxes"
}
Shipping only refund request
{
"items": [] ,
"refundShipping" : true,
"reason": "Some reason"
}
Reponse from POST Refund Request HTTP 202
Returns a 202 with RefundId. Refund id will uniquely identify the refund request and be generated by Hicaps Digital.
After accepting the request, validation ensures that an item refund is executed only once, including shipping.
Default behaviour will be to reject any refund request that doesn’t pass validation.
{
"refundId": "a6991677-9928-48fe-bb3d-5fa5b41d1fba"
}
RefundResult webhook
webhook Body parameters
Field | Format | Required? | Description |
---|---|---|---|
id |
list of strings | Mandatory | Unique identifier of the webhook. |
created |
string | Mandatory | Time stamp of the webhook. |
type |
“paymentResult” | Mandatory | |
data |
data object |
Mandatory |
data parameters
Field | Format | Required? | Description |
---|---|---|---|
basketId |
string | Mandatory | Unique identifier. Generated by HICAPS. It is the sessionId of the session for a completed basket (total amount of the basket is paid). |
refundId |
string | Mandatory | Unique identifier for the refund that triggered this response. |
reference |
string | Mandatory | Reference from the original sessionRequest. |
invoiceId |
string | Optional | Unique identifier of the PHI invoice. Only available when a PHI claim has occurred. |
billerId |
string | Mandatory | Unique identifier of the biller. |
operation |
string = “refund” | Mandatory | |
totalAmountRefunded |
decimal (2 dp) | Mandatory | Sum of amount in the List of refundObjects in status “processed” or “success”. |
errors |
list of strings | Optional | Additional information when not able to proceed with refund. Present for validation errors (e.g. item not found, item already refunded, …) |
refundDetails |
list of refundObjects | Mandatory | List of refund objects, each with details of a specific refund process (refund to card, refund to health fund, …). |
itemsIncludedInRefundRequest |
list of itemsIncludedInRefundRequest objects | Mandatory | List of individual unit items that have been requested to refund, and their original gap and benefit amount. Each original gap will either be successfully refunded or not (there is no part unit item gap refund). The benefit of 1 unit item will be either successfully refunded, requested to be refunded (with no feedback loop allowing to be more precise on the actual status) or rejected. It will be an empty list when shipping only is refunded. |
shippingIncludedInRefundRequest |
shippingIncludedInRefundRequest object |
Optional | Amount > 0 or presence of the object indicate that shipping was requested to be refunded as per original shipping value from eCommerceInvoice |
refundObject parameters
Field | Format | Required? | Description |
---|---|---|---|
refundTo |
“card” or “fund” | Mandatory | Indicates what refund process this object is related to. |
amount |
decimal (2 dp) | Mandatory | Amount successfully processed. |
details |
string | Optional | Additional information. Contains funds name in the case of refundTo Health Fund. |
status |
“success” or “failure” or “processed” | Mandatory | “success” indicates a successful refund of the amount in amount (no further action required). “processed” indicates a successful handover of the refund processing without obtaining a confirmation that the refund has been actioned (e.g. successfully sent an email to a team for processing for the health fund refund). “failure” indicates a failure of processing the refund. Amount will be 0 and “reason” field will contain additional information. |
reason |
string | Optional | Information about the status. |
Note: reason will be empty in case of success for both payment methods. When benefit is processed, it will indicate what type of processing has been done. In case of failure, it will contain the error message causing the failure.
itemsIncludedInRefundRequest parameters
Field | Format | Required? | Description |
---|---|---|---|
itemId |
string | Mandatory | unique identifier of the item (1 unit of the original billerItem). |
billerItemId |
string | Mandatory | Identifier of the line item provided by the biller with the session request. |
originalBenefit |
decimal (2p) | Mandatory | Benefit amount paid by the fund/program for this item prior to any refund taking place. |
originalGap |
decimal (2p) | Mandatory | Remaining out of pocket gap paid by customer prior to any refund taking place. |
shippingIncludedInRefundRequest parameters
Field | Format | Required? | Description |
---|---|---|---|
originalAmount |
decimal (2p) | Mandatory | Amount of shipping that was requested to be refunded. |
Refund webhooks example
Refund webhook for a refund that passed validation and succefully refunded gaps and benefits
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "refundResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"refundId": "41b19cb6-df4d-4626-ade7-5cfe179e4dcd",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "refund",
"totalAmountRefunded": 58,
"refundDetails": [
{
"refundTo": "fund",
"details": "BUPA",
"amount": 30,
"status": "processed",
"reason": "<Additional information provided here>" },
{
"refundTo": "card",
"details": "",
"amount": 28,
"status": "success",
"reason": ""
}
],
"itemsIncludedInRefundRequest": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"originalBenefit": 30,
"originalGap": 10
}
],
"shippingIncludedInRefundRequest": {
"originalAmount" : 18
}
}
}
Refund webhook for a request that didn’t pass validation
Validation ensures that an item refund is executed only once, including shipping.
Default behaviour will be to reject any refund request that doesn’t pass validation.
Item has already been processed
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "refundResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"refundId": "41b19cb6-df4d-4626-ade7-5cfe179e4dcd",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "refund",
"totalAmountRefunded": 0,
"errors": [
"Item 1111ce18-bb10-4390-af84-3a2c56e2dc44 refund has already been processed."
]
}
}
Item does not exist
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "refundResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"refundId": "41b19cb6-df4d-4626-ade7-5cfe179e4dcd",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "refund",
"totalAmountRefunded": 0,
"errors": [
"Item 1111ce18-bb10-4390-af84-3a2c56e2dc55 is not in basket."
]
}
}
Refund webhook for a refund where card refund failed but benefit refund was processed
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "refundResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"refundId": "41b19cb6-df4d-4626-ade7-5cfe179e4dcd",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "refund" ,
"totalAmountRefunded": 30,
"refundDetails": [
{
"refundTo": "fund",
"details": "BUPA",
"amount": 30,
"status": "processed",
"reason": "<Additional information provided here>" },
{
"refundTo": "card",
"details": "",
"amount": 0,
"status": "failure",
"reason": "<Some message from cybersource indicating the reason for failure>"
}
],
"itemsIncludedInRefundRequest": [
{
"itemId": "1111ce18-bb10-4390-af84-3a2c56e2dc44",
"billerItemId": "1",
"originalBenefit": 30,
"originalGap": 10
}
],
"shippingIncludedInRefundRequest": {
"originalAmount" : 18
}
}
}
Refund webhook shipping only
{
"id": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"created": 1678234565,
"type": "refundResult",
"data": {
"basketId": "b6991677-9928-48fe-bb3d-5fa5b41d1fba",
"refundId": "41b19cb6-df4d-4626-ade7-5cfe179e4dcd",
"reference": "3371_9786729",
"invoiceId": "d5e6e8f7-bc9c-4a5b-8c60-8e8ffd665e26",
"billerId": "e6a52d62-0b8f-47c0-b56a-d1e0c745e176",
"operation": "refund" ,
"totalAmountRefunded": 30,
"refundDetails": [
{
"refundTo": "card",
"details": "",
"amount": 30,
"status": "success",
"reason": ""
}
],
"itemsIncludedInRefundRequest": [],
"shippingIncludedInRefundRequest": {
"originalAmount" : 30
}
}
}