Purchases

POST /purchases

Create a new purchase. This endpoint is near real time, the purchase will be enqueued to be processed.

Important: only one of the customers identifier (email, document, service_uid) is required so the API can relate the purchase to an user. Using hard identifiers is highly recommended.

Maximum size of data sent is 256KB

The json with the purchase should be valid with the following json-schema

Request content format

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "A representation of a purchase",
    "type": "object",
    "anyOf": [
        {"required": ["service_uid", "invoice_number", "purchase_detail", "prices"]},
        {"required": ["email", "invoice_number", "purchase_detail", "prices"]},
        {"required": ["document", "invoice_number", "purchase_detail", "prices"]},
        {"required": ["telephone", "invoice_number", "purchase_detail", "prices"]}
    ],
    "properties": {
        "service_uid": { "type": "string" },
        "email": { "type": "string" },
        "document": { "type": "string" },
        "telephone": { "type": "string" },
        "points": { "type": "number", "multipleOf": 1 },
        "invoice_number": { "type": ["string", "integer"] },
        "channel":{"type": "string",
                    "enum": ["web","telephone", "in-store", "corporate", "direct", "other"]
                },
        "purchase_detail": {
            "type": "array",
            "items": {
                "type": "object",
                "required": ["sku", "quantity", "unit_price"],
                "properties": {
                    "sku": {
                        "type": "string",
                        "minLength": 1,
                        "pattern": "^[^-][a-zA-Z0-9_%-]+$"
                    },
                    "base_name": {"type": "string"},
                    "product_name": {"type": "string"},
                    "category": {
                        "type": "array",
                        "items": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "object",
                                    "required": ["id", "name" ],
                                    "properties": {
                                        "id": { "type": "string" },
                                        "name": { "type": "string" },
                                        "url": { "type": "string" },
                                        "image_url": { "type": "string" }
                                    }
                                }
                            ]
                        }
                    },
                    "quantity": { "type": "integer" },
                    "unit_price": { "type": "number" },
                    "variations": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": ["name", "value"],
                            "properties": {
                                "name": {"type": "string"},
                                "value": {"type": "string"}
                            }
                        }
                    },
                    "specifications": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": ["name", "value"],
                            "properties": {
                                "name": { "type": "string" },
                                "value": { "type": "string" }
                            }
                        }
                    },
                    "brand": {"type": "string"},
                    "description": {"type": "string"},
                    "url": {"type": "string"},
                    "image_url": {"type": "string"},
                    "thumbnail_url": {"type": "string"},
                    "stock": {"type": "number"},
                    "available": {"type": "boolean"},
                    "manufacturer_warranty_date": {"type": "date"},
                    "extension_warranty_date": {"type": "date"},
                    "with_extension_warranty": {"type": "boolean"},
                    "custom_attributes": { "type": "object" }
                }
            }
        },
        "prices": {
            "type": "object",
            "required": ["total"],
            "properties": {
                "cost": { "type": "number" },
                "shipping": { "type": "number" },
                "gross": { "type": "number" },
                "tax": { "type": "number" },
                "discount": { "type": "number" },
                "total": { "type": "number" }
            }
        },
        "payment": {
            "oneOf": [
                {
                    "type": "object",
                    "required": ["type"],
                    "properties": {
                        "type":  { "type": "string",
                        "enum": ['credit', 'debit', 'cash', 'mercadopago', 'other']
                        },
                        "brand": { "type": "string" },
                        "bank":  { "type": "string" },
                        "total":  { "type": "float" },
                        "installments":  { "type": "integer" },
                        "card_first_digits":  { "type": "string", "pattern": "^[0-9]{6}$" }
                    }
                },
                {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": ["type","total"],
                        "properties": {
                            "type":  { "type": "string",
                            "enum": ['credit', 'debit', 'cash', 'mercadopago', 'other']
                            },
                            "brand": { "type": "string" },
                            "bank":  { "type": "string" },
                            "total":  { "type": "float" },
                            "installments":  { "type": "integer" },
                            "card_first_digits":  { "type": "string", "pattern": "^[0-9]{6}$" }
                        }
                    }
                }
            ]
        },
        "branch_name": { "type": "string" },
        "seller": {
            "type": "object",
            "required": ["name", "email"],
            "properties": {
                "name": { "type": "string"},
                "email": { "type": "string", "format": "email" },
                "external_id": { "type": "string" }
            }
        },
        "createtime": { "type": "string" },
        "approvedtime": { "type": "string" },
        "metadata": { "type": "object" },
        "custom_attributes": { "type": "object" }
    }
}

Example

This is a valid purchase according to the previous json-schema:

{
  "document": "123456789",
  "points": 24,
  "invoice_number": "FAC-000085643",
  "channel": "web",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "Heladera Patrick",
      "base_name": "Heladera Patrick",
      "category": [
        { "id": "a", "name": "Electrodomésticos"},
        { "id": "a-b", "name": "Linea blanca"},
        { "id": "a-b-c", "name": "Heladeras"}
      ],
      "quantity": 1,
      "unit_price": 1999.00,
      "variations": [
        {
          "name": "Volumen",
          "value": "100 lts"
        }
      ],
      "brand": "Patrick",
      "description": "Su capacidad total de almacenamiento es de 280 litros. El espacio para refrigerador cuenta con 204 litros para ordenar alimentos y bebidas y el freezer tiene un total de 76 litros para congelados.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 10,
      "available": true,
      "specifications": [
        {"name": "Garantia del Fabricante", "value": "12 meses"},
        {"name": "Alto", "value": "143.3 cm"},
        {"name": "Ancho", "value": "60.9 cm"}
      ],
      "manufacturer_warranty_date": "2018-12-31 23:59:59",
      "extension_warranty_date": "2020-12-31 23:59:59",
      "with_extension_warranty": true,
      "custom_attributes": { 
        "millas_aerolineas_plus": 300,
        "codigo_dto": "2354XFD45" 
      }
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 1800.00,
    "tax": 199.00,
    "discount": 100.00,
    "total": 1899.00
  },
  "payment":{
    "type":"credit",
    "brand":"Visa",
    "bank": "Example Bank",
    "total": 1899.00,
    "installments": 12,
    "card_first_digits": "123456"
  },
  "branch_name": "Palermo I",
  "seller":{
    "name": "Seller Relles",
    "email": "seller@email.com",
    "external_id": "0001"
  },
  "createtime": "2017-03-23 14:35:22",
  "approvedtime": "2017-03-23 14:35:22",
  "custom_attributes": { 
    "fecha_max_cambio": "2017-03-26"
  }
}

This is an example:

curl -X POST \
  https://api.woowup.com/apiv3/purchases \
  -H 'accept: application/json' \
  -H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  -d '{
  "document": "123456789",
  "points": 24,
  "invoice_number": "FAC-000085643",
  "channel": "web",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "Heladera Patrick",
      "base_name": "Heladera Patrick",
      "category": [
        { "id": "a", "name": "Electrodomésticos"},
        { "id": "a-b", "name": "Linea blanca"},
        { "id": "a-b-c", "name": "Heladeras"}
      ],
      "quantity": 1,
      "unit_price": 1999.00,
      "variations": [
        {
          "name": "Volumen",
          "value": "100 lts"
        }
      ],
      "brand": "Patrick",
      "description": "Su capacidad total de almacenamiento es de 280 litros. El espacio para refrigerador cuenta con 204 litros para ordenar alimentos y bebidas y el freezer tiene un total de 76 litros para congelados.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 10,
      "available": true,
      "specifications": [
        {"name": "Garantia del Fabricante", "value": "12 meses"},
        {"name": "Alto", "value": "143.3 cm"},
        {"name": "Ancho", "value": "60.9 cm"}
      ],
      "manufacturer_warranty_date": "2018-12-31 23:59:59",
      "extension_warranty_date": "2020-12-31 23:59:59",
      "with_extension_warranty": true,
      "custom_attributes": { 
        "millas_aerolineas_plus": 300,
        "codigo_dto": "2354XFD45" 
      }
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 1800.00,
    "tax": 199.00,
    "discount": 100.00,
    "total": 1899.00
  },
  "payment":{
    "type":"credit",
    "brand":"Visa",
    "bank": "Example Bank",
    "total": 1899.00,
    "installments": 12,
    "card_first_digits": "123456"
  },
  "branch_name": "Palermo I",
  "seller":{
    "name": "Seller Relles",
    "email": "seller@email.com",
    "external_id": "0001"
  },
  "createtime": "2017-03-23 14:35:22",
  "approvedtime": "2017-03-23 14:35:22",
  "custom_attributes": { 
    "fecha_max_cambio": "2017-03-26"
  }
}'

Errors

POST /purchases/bulk

Create multiple purchases in one request. This endpoint is equal to /purchases but accept an array of purchases. This is an example with 2 purchases in one request:

Maximum size per purchase sent is 256KB

curl -X POST \
  https://api.woowup.com/apiv3/purchases \
  -H 'accept: application/json' \
  -H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  -d '[{
  "document": "123456789",
  "points": 24,
  "invoice_number": "FAC-000085643",
  "channel": "web",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "Heladera Patrick",
      "base_name": "Heladera Patrick",
      "category": [
        { "id": "a", "name": "Electrodomésticos"},
        { "id": "a-b", "name": "Linea blanca"},
        { "id": "a-b-c", "name": "Heladeras"}
      ],
      "quantity": 1,
      "unit_price": 1999.00,
      "variations": [
        {
          "name": "Volumen",
          "value": "100 lts"
        }
      ],
      "brand": "Patrick",
      "description": "Su capacidad total de almacenamiento es de 280 litros. El espacio para refrigerador cuenta con 204 litros para ordenar alimentos y bebidas y el freezer tiene un total de 76 litros para congelados.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 10,
      "available": true,
      "specifications": [
        {"name": "Garantia del Fabricante", "value": "12 meses"},
        {"name": "Alto", "value": "143.3 cm"},
        {"name": "Ancho", "value": "60.9 cm"}
      ],
      "custom_attributes": { 
      	"millas_aerolineas_plus": 300,
      	"codigo_dto": "2354XFD45" 
      }
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 1800.00,
    "tax": 199.00,
    "discount": 100.00,
    "total": 1899.00
  },
  "payment":{
    "type":"debit",
    "brand":"Amex",
    "bank": "Example Bank"
  },
  "branch_name": "Palermo I",
  "createtime": "2017-03-23 14:35:22",
  "custom_attributes": { 
  	"fecha_max_cambio": "2017-03-26"
  }
},
{
  "document": "987654321",
  "points": 24,
  "invoice_number": "FAC-000085644",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "TV Samsung",
      "base_name": "TV Samsung",
      "category": [
        { "id": "x", "name": "Electrodomésticos"},
        { "id": "x-y", "name": "Hogar"},
        { "id": "x-y-z", "name": "TV"}
      ],
      "quantity": 1,
      "unit_price": 3500.00,
      "variations": [
        {
          "name": "Tamaño",
          "value": "42 pulgadas"
        }
      ],
      "brand": "Samsung",
      "description": "Pasá videos, música y fotos desde tu móvil o PC a tu TV mediante una conexión sencilla gracias a la aplicación Samsung View.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 20,
      "available": true,
      "specifications": [
        {"name": "Profundidad (con base)", "value": "29.4 cm"},
        {"name": "Alto", "value": "71 cm"},
        {"name": "Ancho", "value": "110 cm"}
      ]
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 3300.00,
    "tax": 200.00,
    "discount": 100.00,
    "total": 3400.00
  },
  "payment":{
    "type":"credit",
    "brand":"Visa",
    "bank": "Another Bank"
  },
  "branch_name": "Palermo I",
  "seller":{
    "name": "Seller Relles",
    "email": "seller@email.com",
    "external_id": "0001"
  },
  "createtime": "2017-03-23 14:35:22"
}]'

Errors

PUT /purchases

Update a purchase. This endpoint is near real time, the purchase will be enqueued to be processed.

Maximum size of data sent is 256KB

Example

This is a valid purchase according to the previous json-schema:

{
  "document": "1234567890",
  "points": 24,
  "invoice_number": "FAC-000085643",
  "channel": "web",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "Heladera Patrick",
      "base_name": "Heladera Patrick",
      "category": [
        { "id": "a", "name": "Electrodomésticos"},
        { "id": "a-b", "name": "Linea blanca"},
        { "id": "a-b-c", "name": "Heladeras"}
      ],
      "quantity": 1,
      "unit_price": 1999.00,
      "variations": [
        {
          "name": "Volumen",
          "value": "100 lts"
        }
      ],
      "brand": "Patrick",
      "description": "Su capacidad total de almacenamiento es de 280 litros. El espacio para refrigerador cuenta con 204 litros para ordenar alimentos y bebidas y el freezer tiene un total de 76 litros para congelados.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 10,
      "available": true,
      "specifications": [
        {"name": "Garantia del Fabricante", "value": "12 meses"},
        {"name": "Alto", "value": "143.3 cm"},
        {"name": "Ancho", "value": "60.9 cm"}
      ],
      "custom_attributes": { 
      	"millas_aerolineas_plus": 500,
      	"codigo_dto": "20054XFD46" 
      }
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 1800.00,
    "tax": 199.00,
    "discount": 100.00,
    "total": 1899.00
  },
  "payment":{
    "type":"credit",
    "brand":"Visa",
    "bank": "Example Bank"
  },
  "branch_name": "Palermo I",
  "seller":{
    "name": "Seller Relles",
    "email": "seller@email.com",
    "external_id": "0001"
  },
  "createtime": "2017-03-23 14:35:22",
  "approvedtime": "2017-03-23 14:35:22",
  "custom_attributes": { 
	"fecha_max_cambio": "2017-03-30"
  }
}

This is an example:

curl -X PUT \
  https://api.woowup.com/apiv3/purchases \
  -H 'accept: application/json' \
  -H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  -d '{
  "document": "1234567890",
  "points": 24,
  "invoice_number": "FAC-000085643",
  "channel": "web",
  "purchase_detail": [
    {
      "sku": "2907362",
      "product_name": "Heladera Patrick",
      "base_name": "Heladera Patrick",
      "category": [
        { "id": "a", "name": "Electrodomésticos"},
        { "id": "a-b", "name": "Linea blanca"},
        { "id": "a-b-c", "name": "Heladeras"}
      ],
      "quantity": 1,
      "unit_price": 1999.00,
      "variations": [
        {
          "name": "Volumen",
          "value": "100 lts"
        }
      ],
      "brand": "Patrick",
      "description": "Su capacidad total de almacenamiento es de 280 litros. El espacio para refrigerador cuenta con 204 litros para ordenar alimentos y bebidas y el freezer tiene un total de 76 litros para congelados.",
      "url": "http://www.example.com/example",
      "image_url": "http://www.example.com/example",
      "thumbnail_url": "http://www.example.com/example",
      "stock": 10,
      "available": true,
      "specifications": [
        {"name": "Garantia del Fabricante", "value": "12 meses"},
        {"name": "Alto", "value": "143.3 cm"},
        {"name": "Ancho", "value": "60.9 cm"}
      ],
      "custom_attributes": { 
      	"millas_aerolineas_plus": 500,
      	"codigo_dto": "20054XFD46" 
      }
    }
  ],
  "prices": {
    "cost": 800.00,
    "shipping": 120.00,
    "gross": 1800.00,
    "tax": 199.00,
    "discount": 100.00,
    "total": 1899.00
  },
  "payment":{
    "type":"credit",
    "brand":"Visa",
    "bank": "Example Bank"
  },
  "branch_name": "Palermo I",
  "seller":{
    "name": "Seller Relles",
    "email": "seller@email.com",
    "external_id": "0001"
  },
  "createtime": "2017-03-23 14:35:22",
  "approvedtime": "2017-03-23 14:35:22",
  "custom_attributes": { 
	"fecha_max_cambio": "2017-03-30"
  }
}'

Errors

GET /purchases

Search a purchase.

Query by invoice_number returns only the first purchase created.

Example

curl -X GET \
  -H 'accept: application/json' \
  -H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  "https://api.woowup.com/apiv3/purchases?service_uid=12345"

Response

{
    "payload": [
        {
            "service_uid": "12345",
            "document": "23456789",
            "email" "email@example.com",
            "invoice_number": "00001",
            "channel": null,
            "purchase_detail": {
                "items": [
                    {
                        "product_id": "543V",
                        "product_name": "Manta Panal",
                        "quantity": 1,
                        "price": 1999,
                        "custom_attributes": {
                            "codigo_dto": "2354XFD45",
                            "millas_aerolineas_plus": 300
                        }
                    }
                ]
            },
            "prices": {
                "total": 1999,
                "gross": 1999,
                "discount": 0,
                "shipping": 0,
                "tax": 0,
                "cost": 0
            },
            "points": 0,
            "downloadtime": "2018-05-10 23:30:49",
            "createtime": "2018-05-10 23:30:49",
            "custom_attributes": {
                "fecha_max_cambio": "2017-03-26 00:00:00"
            },
            "cancel_transaction_id": null,
            "branch": null,
            "payment": {
                "type": "other",
                "brand": null,
                "name": null
            },
            "purchase_operator": null,
            "pickup_store": "SHOPPING LOCAL 1",
            "promotions": null
        },
        {
            "service_uid": "12345",
            "document": "23456789",
            "email" "email@example.com",
            "invoice_number": "00002",
            "channel": null,
            "purchase_detail": {
                "items": [
                    {
                        "product_id": "123V",
                        "product_name": "Botas Color Rosa",
                        "quantity": 1,
                        "price": 1999
                    }
                ]
            },
            "prices": {
                "total": 1999,
                "gross": 1999,
                "discount": 0,
                "shipping": 0,
                "tax": 0,
                "cost": 0
            },
            "points": 0,
            "downloadtime": "2018-05-10 23:30:49",
            "createtime": "2018-05-10 23:30:49",
            "cancel_transaction_id": null,
            "branch": null,
            "payment": {
                "type": "other",
                "brand": null,
                "name": null
            },
            "purchase_operator": null,
            "pickup_store": "SHOPPING LOCAL 1",
            "promotions": null
        }
    ],
    "message": "ok",
    "code": "ok",
    "time": "62ms"
}

Errors

GET /purchases/iin/{firstSixDigits}

Retrieve information about bank by first six digits of credit/debit card

Example

curl -X GET \
  -H 'accept: application/json' \
  -H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  "https://api.woowup.com/apiv3/purchases/iin/123456"

Response

{
    "payload": {
        "scheme": "visa",
        "brand": "Visa/Dankort",
        "type": "debit",
        "prepaid": "",
        "country": "DK",
        "bank": {
            "name": "Spar Nord",
            "logo": "",
            "url": "www.sparnord.dk",
            "phone": "",
            "city": ""
        }
    },
    "message": "ok",
    "code": "ok",
    "time": "109ms"
}

Errors

Delete purchase

DELETE https://api.woowup.com/apiv3/purchases

Delete a purchase

Request Body

{
    "payload": [],
    "message": "ok",
    "code": "ok",
    "time": "98ms"
}

Example

curl -X DELETE \
  https://api.woowup.com/apiv3/purchases \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXX' \
  -H 'Content-Type: application/json' \
  -d '{
	"invoice_number": "987654321"
}'

Response

{
    "payload": [],
    "message": "ok",
    "code": "ok",
    "time": "98ms"
}

Delete purchases (bulk)

DELETE https://api.woowup.com/apiv3/purchases/bulk

Request Body

{
    "payload": {
        "request_id": "XXX"
    },
    "message": "ok",
    "code": "ok",
    "time": "111ms"
}

Very (VERY) important

Both dates 'from' and 'to' must be specified in UTC time. For example we want 'from' date to be August 22nd 2019 at 3 p.m in Argentina. As Argentina's timezone is UTC-3, 'from' will be set as '2019-08-22 16:00:00'

optional / required body parameters

        "anyOf": [
            {"required": ["branch_name"]},
            {"required": ["from", "to"]}
        ]

Example

curl -X DELETE \
  https://api.woowup.com/apiv3/purchases/bulk \