Awardit Adapter
Overview
Awardit adapter creates payments with Awardit gift cards.
Note
This documentation is currently being worked on, update coming shortly.
Configuration
Add the Awardit adapter in the Norce Checkout Admin, where you'll be asked to provide api settings:
- Base URL
- Username
- Password
- Shop ID
Create payment
Add a payment to your existing Norce order by providing card id and code.
POST /api/checkout/v1/orders/{order_id}/payments
{
"cardId": "3141592653589793",
"code": "23846"
}
The adapter will fetch the Norce order and fetch the Awardit card status, finding out what the remaining card balance is as well as if the code is required. If the card is not found, the balance is zero, or if a code is required but not provided we'll receive a BadRequest response.
note
The pin code is not validated at this point, we can only see if the pin code is required.
The adapter will return the amount that would be covered by the gift card as well as an upperLimitAmount informing you of the card balance.
{
"cardId": "3141592653589793",
"code": "23846",
"amount": 149.5,
"upperLimitAmount": 1000
}
It is possible to add multiple gift cards.
Example
Order total: 150 SEK
First gift card
- Remaining card balance: 100 SEK
- Amount covered: 100 SEK
Second gift card
- Remaining card balance: 100 SEK
- Amount covered: 50 SEK
Remove gift card
To remove a gift card simply call
POST /api/checkout/v1/orders/{order_id}/payments/{payment_id}/remove
This is a soft delete and the payment will still be visible as removed. If you add the same card again a new payment will be created.
Order updates
If the order continues to update after the gift card has been added then the gift card payment will be updated appropriately. This might happen if the order total is increased or another payment is removed.
Processing
When an order changes state to Processing, the adapter will be attempt to reseve the amount before approving the state change.
The adapter will stop the state change if the pin code is invalid or if the amount to be covered is greated than the remaining card balance, this might happen if the user attempts to use the gift card in two sessions at the same time.
Aborting processing
If the order changes state back to Checkout, the adapter will remove the reservation.
Checkout completed
When an order changes state to Completed, the adapter will commit the reserved amount, in effect reducing the remaining card balance by the covered amount.