AddEvent

Summary

Add event to account

Resource URL /api/v3/customer-account/{accountNumber}/event
HTTP method POST
Content type application/json; charset=utf-8

Input parameters

Parameter name Location Type / Model Description
accountNumber Path required
Account number
request Body AddEventToAccountRequest required

Responses

HTTP status code Model Comment
OK(200) AddEventToAccountResponse Add event to customer account response
BadRequest (400) array of ResponseMessage Request failed. Check response model for list of Errors.
Unauthorized (401) API user is unauthorized. Make sure X-Auth-Key header is sent.
InternalServerError (500) Request failed due internal error. Retry request later.

Examples

{
  "eventType": "Purchase",
  "time": "2016-02-01T00:00:00Z",
  "nfcId": "NFC884661000",
  "posId": "POS781000545",
  "posName": "Optional POS Terminal name",
  "totalTax": 0.0,
  "totalAmount": 63.0,
  "items": [
    {
      "itemId": "10",
      "itemDescription": "Boots",
      "unitCode": "777",
      "quantity": 1.0,
      "unitPrice": 50.50,
      "netAmount": 50.50,
      "taxAmount": 0.0,
      "discount": 0.0,
      "grossAmount": 50.50
    },
    {
      "itemId": "52599",
      "itemDescription": "Belt",
      "unitCode": "888",
      "quantity": 1.0,
      "unitPrice": 12.50,
      "netAmount": 12.50,
      "taxAmount": 0.0,
      "discount": 0.0,
      "grossAmount": 12.50
    }
  ]
}
{
  "eventAdded": true,
  "transactionId": "9c49c2b6-6135-41db-8e09-cf89e465b32f"
}
var AfterPayApi = require("./afterPay.js");
var apiKeyAuthentication = require("./api_key_filter");

var key = 'CHANGE_ME';
var client = new AfterPayApi().addFilter(apiKeyAuthentication.create(key));
var request = {
  "eventType": "Purchase",
  "time": "2016-02-01T00:00:00Z",
  "nfcId": "NFC884661000",
  "posId": "POS781000545",
  "posName": "Optional POS Terminal name",
  "totalTax": 0.0,
  "totalAmount": 63.0,
  "items": [
    {
      "itemId": "10",
      "itemDescription": "Boots",
      "unitCode": "777",
      "quantity": 1.0,
      "unitPrice": 50.50,
      "netAmount": 50.50,
      "taxAmount": 0.0,
      "discount": 0.0,
      "grossAmount": 50.50
    },
    {
      "itemId": "52599",
      "itemDescription": "Belt",
      "unitCode": "888",
      "quantity": 1.0,
      "unitPrice": 12.50,
      "netAmount": 12.50,
      "taxAmount": 0.0,
      "discount": 0.0,
      "grossAmount": 12.50
    }
  ]
};
var accountNumber = "0100.0000006";

client.CustomerAccount.addEvent(accountNumber, request, 
  function(err, response, httpRequest, httpResponse) {
  });
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'after_pay.rb'
require 'json'

client = AfterPayApi::AfterPay.new(AfterPayApi::ApiKeyCredentials.new('YOUR_API_KEY'))

requestAsJson = '{"eventType":"Purchase","time":"2016-02-01T00:00:00Z","nfcId":"NFC884661000","posId":"POS781000545","posName":"Optional POS Terminal name","totalTax":0.0,"totalAmount":63.0,"items":[{"itemId":"10","itemDescription":"Boots","unitCode":"777","quantity":1.0,"unitPrice":50.50,"netAmount":50.50,"taxAmount":0.0,"discount":0.0,"grossAmount":50.50},{"itemId":"52599","itemDescription":"Belt","unitCode":"888","quantity":1.0,"unitPrice":12.50,"netAmount":12.50,"taxAmount":0.0,"discount":0.0,"grossAmount":12.50}]}'
request = AfterPayApi::Models::AddEventToAccountRequest.deserialize_object(JSON.parse(requestAsJson))

accountNumber = "0100.0000006";

client.customerAccount.addEvent_async(accountNumber, request).then{|response|

}.execute.wait
var key = "CHANGE_ME";
var client = new CustomerAccountApi(new Configuration() { DefaultHeader = new Dictionary<string, string>() { { "X-Auth-Key", key} } });

var request = new AddEventRequest(){
  EventType = EventType.Purchase,
  CategoryType = CategoryType.NotSet,
  Time = "2016-02-01 00:00:00",
  NfcId = "NFC884661000",
  PosId = "POS781000545",
  PosName = "Optional POS Terminal name",
  TotalAmount = 63.0,
  Items = new List<EventItem> {
  new EventItem() {
      ItemId = "10",
      ItemDescription = "Boots",
      UnitCode = "777",
      Quantity = 1,
      UnitPrice = 50.50,
      NetAmount = 50.50,
      GrossAmount = 50.50
    },
  new EventItem() {
      ItemId = "52599",
      ItemDescription = "Belt",
      UnitCode = "888",
      Quantity = 1,
      UnitPrice = 12.50,
      NetAmount = 12.50,
      GrossAmount = 12.50
    },
  }
};
var accountNumber = "0100.0000006";

var responce = client.CustomerAccountAddEvent(accountNumber, request);