Basket Information & Product Catalogue
Basket information in transaction message
The following example shows how you can use the basket parameters to document in the transaction what has been sold.
<ns5:IPGApiOrderRequest
xmlns:ns5="http://ipg-online.com/ipgapi/schemas/ipgapi"
xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1"
xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns2:Transaction>
<ns2:CreditCardTxType>
<ns2:Type>sale</ns2:Type>
</ns2:CreditCardTxType>
<ns2:CreditCardData>
<ns2:CardNumber>4035..…4977</ns2:CardNumber>
<ns2:ExpMonth>12</ns2:ExpMonth>
<ns2:ExpYear>24</ns2:ExpYear>
</ns2:CreditCardData>
<ns2:Payment>
<ns2:ChargeTotal>1</ns2:ChargeTotal>
<ns2:Currency>EUR</ns2:Currency>
</ns2:Payment>
<ns2:TransactionDetails>
<ns2:OrderId>68d4a595-fd58-4859-83cd-1ae13962a3ac</ns2:OrderId>
</ns2:TransactionDetails>
<ns2:Basket>
<ns2:Item>
<ns2:ID>product ID xyz</ns2:ID>
<ns2:Description>description of abc</ns2:Description>
<ns2:ChargeTotal>11</ns2:ChargeTotal>
<ns2:Currency>EUR</ns2:Currency>
<ns2:Quantity>5</ns2:Quantity>
<ns2:Option>
<ns2:Name>colour
</ns2:Option>
<ns2:Choice>blue</ns2:Choice>
</ns2:Option>
<ns2:Option>
<ns2:Name>size
</ns2:Option>
<ns2:Choice>large</ns2:Choice>
</ns2:Option>
</ns2:Item>
</ns2:Basket>
</ns2:Transaction>
</ns5:IPGApiOrderRequest>
Setting up a Product Catalogue
You can store basic information about the products you sell in the following way:
<ns5:IPGApiActionRequest
xmlns:ns5="http://ipg-online.com/ipgapi/schemas/ipgapi"
xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1"
xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns3:Action>
<ns3:ManageProducts>
<ns3:Function>store</ns3:Function>
<ns3:Product>
<ns3:ProductID>product ID xyz</ns3:ProductID>
<ns2:ChargeTotal>2</ns2:ChargeTotal>
<ns2:Currency>EUR</ns2:Currency>
<ns3:OfferStarts>2024-12-27T13:29:41.000+01:00</ns3:OfferStarts>
<ns3:OfferEnds>2025-09-19T14:29:41.000+02:00</ns3:OfferEnds>
<ns2:Option>
<ns2:Name>colour
</ns2:Option>
<ns2:Choice>blue</ns2:Choice>
</ns2:Option>
<ns2:Option>
<ns2:Name>size
</ns2:Option>
<ns2:Choice>large</ns2:Choice>
</ns2:Option>
</ns3:Product>
</ns3:ManageProducts>
</ns3:Action>
</ns5:IPGApiActionRequest>
OfferStarts and OfferEnds are optional and can be used to restrict the visibility of the related products in custom applications but they will not restrict the possibility of a sale. There are further optional fields Description, OptionName and Name. Please take a look at the a1.xsd in the appendix of this document.
The function display shows the requested product with every characteristics.
<ns5:IPGApiActionRequest
xmlns:ns5="http://ipg-online.com/ipgapi/schemas/ipgapi"
xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1"
xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns3:Action>
<ns3:ManageProducts>
<ns3:Function>display</ns3:Function>
<ns3:Product>
<ns3:ProductID>product ID xyz</ns3:ProductID>
</ns3:Product>
</ns3:ManageProducts>
</ns3:Action>
</ns5:IPGApiActionRequest>
The function delete can be used to set the available stock of a product to zero.
<ns5:IPGApiActionRequest
xmlns:ns5="http://ipg-online.com/ipgapi/schemas/ipgapi"
xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1"
xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns3:Action>
<ns3:ManageProducts>
<ns3:Function>delete</ns3:Function>
<ns3:Product>
<ns3:ProductID>product ID xyz</ns3:ProductID>
</ns3:Product>
</ns3:ManageProducts>
</ns3:Action>
</ns5:IPGApiActionRequest>
Manage Product Stock
For every product stock function, the product ID and given options need to exist in your Product Catalogue.
After you have installed a product, you can fill the product stock with the function add.
<ns5:IPGApiActionRequest
xmlns:ns5=http://ipg-online.com/ipgapi/schemas/ipgapi xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1" xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns3:Action>
<ns3:ManageProductStock>
<ns3:Function>add</ns3:Function>
<ns3:ProductStock>
<ns3:ProductID>product ID xyz</ns3:ProductID>
<ns2:Option>
<ns2:Name>colour</ns2:Option>
<ns2:Choice>blue</ns2:Choice>
</ns2:Option>
<ns2:Option>
<ns2:Name>size</ns2:Option>
<ns2:Choice>large</ns2:Choice>
</ns2:Option>
<ns3:Quantity>13</ns3:Quantity>
</ns3:ProductStock>
</ns3:ManageProductStock>
</ns3:Action>
</ns5:IPGApiActionRequest>
The function substract works in the same way, but will only change the quantity, if the difference will not be negative. If you want to set the quantity to zero you can use the function delete described above.
Sale transactions using product stock
After you have set up the product stock, you can use it to verify if there are enough items on stock for a transaction. A successful transaction will then substract the quantity. If the product stock contains less than the requested quantity, the transaction will be rejected without any changes to the product stock.
To use this function, add <ns2:ProductStock>check</ns2:ProductStock> to Basket.
<ns5:IPGApiOrderRequest
xmlns:ns5="http://ipg-online.com/ipgapi/schemas/ipgapi"
xmlns:ns2="http://ipg-online.com/ipgapi/schemas/v1"
xmlns:ns3="http://ipg-online.com/ipgapi/schemas/a1">
<ns2:Transaction>
<ns2:CreditCardTxType>
<ns2:Type>sale</ns2:Type>
</ns2:CreditCardTxType>
<ns2:CreditCardData>
<ns2:CardNumber>4035....4977</ns2:CardNumber>
<ns2:ExpMonth>12</ns2:ExpMonth>
<ns2:ExpYear>14</ns2:ExpYear>
</ns2:CreditCardData>
<ns2:Payment>
<ns2:ChargeTotal>1</ns2:ChargeTotal>
<ns2:Currency>EUR</ns2:Currency>
</ns2:Payment>
<ns2:TransactionDetails>
<ns2:OrderId>68d4a595-fd58-4859-83cd-1ae13962a3ac</ns2:OrderId>
</ns2:TransactionDetails>
<ns2:Basket>
<ns2:ProductStock>check</ns2:ProductStock>
<ns2:Item>
<ns2:ID>product ID xyz</ns2:ID>
<ns2:Description>description of abc</ns2:Description>
<ns2:ChargeTotal>11</ns2:ChargeTotal>
<ns2:Currency>EUR</ns2:Currency>
<ns2:Quantity>5</ns2:Quantity>
<ns2:Option>
<ns2:Name>colour
</ns2:Option>
<ns2:Choice>blue</ns2:Choice>
</ns2:Option>
<ns2:Option>
<ns2:Name>size
</ns2:Option>
<ns2:Choice>large</ns2:Choice>
</ns2:Option>
</ns2:Item>
</ns2:Basket>
</ns2:Transaction>
</ns5:IPGApiOrderRequest>
Updated 3 months ago