LLSR API - Payment API Specification and Examples
Root Nodes
/payment Payment API root node
/payment/transactions The set of all transactions
/payment/transactions
Reading
You can't read a transaction using the Payment API.
Publishing
Publishing to the transactions collection corresponds to a request to process payment. Payments can be settled using a Lake Louise Ski Resort gift card or a Visa/Mastercard/American Express credit card.
The valid values for transType are charge, void, and refund.
LLSR Gift Card
POST /payment/transactions HTTP/1.1
Host: api.skilouise.com
transType=charge&cardNumber=3344556677889900&amount=1.00
In this example, a charge of $1.00 would be attempted on the gift card numbered 3344 5566 7788 9900.
If this card were a gift card with either a balance greater than or equal to $1.00, or a valid linked credit card (i.e. a LouiseXpress gift card), an example of a response to a successful charge would be:{
"transType":"charge",
"success":"true",
"authCode":"12345",
"transAmount":"1.00",
"transID":"123456",
"remainder":"false"
}
If this gift card had a balance less than $1.00 (e.g., $0.65) and did not have a valid linked credit card, an example of a response to an unsuccessful charge would be:
{
"transType":"charge",
"success":"false",
"authCode":"12345",
"transAmount":"0.65",
"transID":"123456",
"remainder":"0.35"
}
An error is returned when:
- the gift card has a zero balance and does not have a valid linked credit card
- there is an unexpected failure to decrement the gift card's balance
- the gift card is a associated with a season pass that has been hotlisted
- the gift card has not been activated
If any of these errors are encountered, an error response is returned, e.g.:
{
"error":{
"message":"Gift card charge failed: Insufficient funds"
}
}
The following would void the preceding transaction in this example:
POST /payment/transactions HTTP/1.1
Host: api.skilouise.com
transType=void&cardNumber=3344556677889900&transID=123456
Note that both the cardNumber and transID values must match those of the transaction being voided.
An example of a response to a successful void transaction would be:
{
"transType":"void",
"success":"true",
"transID":"123456"
}
An error is returned when:
- the specified transID does not exist, or does not correspond to the specified cardNumber
- there is an unexpected failure to increment the gift card's balance
If any of these errors are encountered, an error response is returned, e.g.:
{
"error":{
"message":"Gift card void failed: transID missing or does not match cardNumber"
}
}
The following would void the preceding transaction
Refunds can also be processed using the transactions endpoint; for example:
POST /payment/transactions HTTP/1.1
Host: api.skilouise.com
transType=refund&cardNumber=3344556677889900&amount=1.00&transID=123456
In this example, a refund of $1.00 would be attempted on the gift card numbered 3344 5566 7788 9900.
Note that the transID parameter is optional on refund transactions, but is recommended for better matching of refund transactions to their originating charge transaction. All other parameters are required.
An example of a response to a successful void transaction would be:
{
"transType":"refund",
"success":"true",
"transAmount":"1.00",
"transID":"123456"
}
An error is returned when:
- there is an unexpected failure to increment the gift card's balance
- the gift card is a associated with a season pass that has been hotlisted
- the gift card has not been activated
If any of these errors are encountered, an error response is returned, e.g.:
{
"error":{
"message":"Gift card refund failed: Card could not be refunded"
}
}
The following would void the preceding transaction
Credit Card
POST /payment/transactions HTTP/1.1
Host: api.skilouise.com
transType=charge&cardholderName=Test Card&cardNumber=4455667788990011&cardExpiry=0120&cvv=456&amount=1.00&invoiceNumber=N999
In this example, a charge of $1.00 would be attempted on the (Visa) credit card numbered 4455 6677 8899 0011, exp 01/20. The Cardholder Name and CVV - provided in this example - are recommended for all charge transactions, but is not required for a successful transaction. The invoice number is also optional, but useful for tracking payments within the calling application. An example of a response to a successful charge would be:
{
"transType":"charge",
"success":"true",
"authCode":"123456",
"transAmount":"1.00",
"transID":"123456789012345",
"merchantID":"98765432109",
"gstNumber":"246801357XY999",
"transDate":"1970-01-01 00:00:00",
"transNumber":"546372819",
"cardNumber":"4455********0011",
"cardExpiry":"****",
"cardType":"VISA",
"entry":"Manual/CVV",
"invoiceNumber":"N999",
"resultCode":"0",
"message":"AP"
}
Here, "authCode" may refer to the transaction's approval code, and "transID" to the transaction's PNREF number.
If the balance on this credit card were insufficient to pay the amount being debited in the transaction, an example of a response to an unsuccessful charge would be:
{
"transType":"charge",
"success":"false",
"authCode":"",
"transAmount":"1.00",
"transID":"123456789012345",
"merchantID":"98765432109",
"gstNumber":"246801357XY999",
"transDate":"1970-01-01 00:00:00",
"transNumber":"546372819",
"cardNumber":"4455********0011",
"cardExpiry":"****",
"cardType":"VISA",
"entry":"Manual/CVV",
"invoiceNumber":"N999",
"resultCode":"12",
"message":"DECLINED"
}
Other examples of result codes for unsuccessful transactions include (not an exhaustive list):
- 7 - Field Format Error
- 110 - Duplicate Transaction
- 1000 - Generic Host Error
An error is returned when:
- there is an unexpected failure in charging the credit card (e.g., communication error with payment gateway)
- the credit card type is unrecognised
- no valid merchant was available to complete the transaction (your API key has an associated merchant number)
If any of these errors are encountered, an error response is returned, e.g.:
{
"error":{
"message":"Credit card charge failed"
}
}
Updating
You can't update a transaction using the Payment API. Transactions are requested/performed by publishing to the transactions collection.
Deleting
You can't delete a transaction using the Payment API.
HTTP Status Codes
The Payment API uses the following standard HTTP status codes:
200: OK
400: Bad Request
401: Unauthorized
503: Service Unavailable