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" },
"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" },
"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:

Bash
PHP
python3
Bash
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"
}
}'
PHP
<?php
$purchase = {{purchase}};
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.woowup.com/apiv3/purchases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $purchase,
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cache-control: no-cache,no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
python3
import requests
url = "https://api.woowup.com/apiv3/purchases"
payload = {{purchase}}
headers = {
'accept': "application/json",
'authorization': "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
'cache-control': "no-cache,no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

Errors

HttpCode

HttpCode Name

Code

Description

200

ok

ok

Purchase successfully saved

400

bad request

bad_request

Invalid parameters, view message for more details

429

too many requests

too_many_requests

API's requests-per-second limit exceeded

500

internal error

user_not_found

User not found

500

internal error

duplicated_purchase_number

Duplicated purchase number

500

internal error

internal_error

Unexpected error

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

HttpCode

HttpCode Name

Code

Description

200

ok

ok

Purchases successfully saved

400

bad request

bad_request

Invalid parameters, view message for more details

429

too many requests

too_many_requests

API's requests-per-second limit exceeded

500

internal error

user_not_found

User not found

500

internal error

duplicated_purchase_number

Duplicated purchase number

500

internal error

internal_error

Unexpected error

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:

Bash
PHP
python3
Bash
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"
}
}'
PHP
<?php
$purchase = {{purchase}};
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.woowup.com/apiv3/purchases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => $purchase,
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cache-control: no-cache,no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
python3
import requests
url = "https://api.woowup.com/apiv3/purchases"
payload = {{purchase}}
headers = {
'accept': "application/json",
'authorization': "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
'cache-control': "no-cache,no-cache"
}
response = requests.request("PUT", url, data=payload, headers=headers)
print(response.text)

Errors

HttpCode

HttpCode Name

Code

Description

200

ok

ok

Purchase successfully updated

400

bad request

bad_request

Invalid parameters, view message for more details

429

too many requests

too_many_request

API's requests-per-second limit exceeded

500

internal error

user_not_found

User not found

500

internal error

inexistent_purchase_number

Purchase number inexistent

500

internal error

internal_error

Unexpected error

GET /purchases

Search a purchase.

Parameter

Type

Required

Description

service_uid

query

No

invoice_number

query

No

Example

Bash
PHP
python3
Bash
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"
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.woowup.com/apiv3/purchases?service_uid=12345",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cache-control: no-cache,no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
python3
import requests
url = "https://api.woowup.com/apiv3/purchases"
querystring = {"service_uid":"12345"}
headers = {
'accept': "application/json",
'authorization': "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
'cache-control': "no-cache,no-cache",
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)

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

HttpCode

HttpCode Name

Code

Description

200

ok

ok

Request successful

400

bad request

bad_request

Invalid parameters, view message for more details

404

not found

not_found

Purchase not found

429

too many requests

too_many_requests

API's requests-per-second limit exceeded

500

internal error

internal_error

Unexpected error

GET /purchases/iin/{firstSixDigits}

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

Parameter

Type

Required

Description

firstSixDigits

url

Yes

First six digit of credit/debit card

Example

Bash
PHP
python3
Bash
curl -X GET \
-H 'accept: application/json' \
-H 'authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'cache-control: no-cache' \
"https://api.woowup.com/apiv3/purchases/iin/123456"
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.woowup.com/apiv3/purchases/iin/123456",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cache-control: no-cache,no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
python3
import requests
url = "https://api.woowup.com/apiv3/purchases/iin/123456"
headers = {
'accept': "application/json",
'authorization': "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
'cache-control': "no-cache,no-cache"
}
response = requests.request("GET", url, headers=headers)
print(response.text)

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

HTTP Code

HTTP Code Name

Decription

200

Ok

Succesful request

404

Not Found

IIN not found

429

Too Many Requests

Too Many Requests

500

Internal Error

Unexpected error

delete
Delete purchase

https://api.woowup.com/apiv3/purchases
Delete a purchase
Request
Response
Request
Body Parameters
invoice_number
required
string
branch_name
optional
string
Response
200: OK
{
"payload": [],
"message": "ok",
"code": "ok",
"time": "98ms"
}
400: Bad Request
{
"payload": {
"errors": [
"Required properties missing: [\"invoice_number\"]"
]
},
"message": "bad request",
"code": "bad_request",
"time": "124ms"
}
403: Forbidden
{
"payload": [],
"message": "forbidden: authentication failed",
"code": "forbidden",
"time": "7ms"
}
404: Not Found
//purchase
{
"payload": {
"errors": [
"purchase not found"
]
},
"message": "purchase not found",
"code": "not_found",
"time": "77ms"
}
//branch
{
"payload": {
"errors": [
"branch not found"
]
},
"message": "branch not found",
"code": "not_found",
"time": "70ms"
}
500: Internal Server Error
{
"payload": [],
"message": "",
"code": "internal_error",
"time": "72ms"
}

Example

Bash
PHP
python3
Bash
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"
}'
PHP
python3
import requests
url = "https://api.woowup.com/apiv3/purchases"
payload = "{\"invoice_number\": \"987654321\"}"
headers = {
'Accept': "application/json",
'Authorization': "Basic XXXXXXXXXXXXXXXXXXXX",
'Content-Type': "application/json",
'cache-control': "no-cache"
}
response = requests.request("DELETE", url, data=payload, headers=headers)
print(response.text)

Response

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

delete
Delete purchases (bulk)

https://api.woowup.com/apiv3/purchases/bulk
Request
Response
Request
Body Parameters
branch_name
optional
string
from
optional
string
date format YYYY-MM-DD hh:mm:ss (in UTC time)
to
optional
string
date format YYYY-MM-DD hh:mm:ss (in UTC-time)
notify_to
optional
string
email to receive the confirmation
Response
200: OK
will be receive an email when the deletion process is finished
{
"payload": {
"request_id": "XXX"
},
"message": "ok",
"code": "ok",
"time": "111ms"
}
400: Bad Request
//bad_request
{
"payload": {
"errors": [
"Failed matching any of the provided schemas."
]
},
"message": "bad request",
"code": "bad_request",
"time": "38ms"
}
//invalid_email
{
"payload": [],
"message": "Invalid email to notify",
"code": "invalid_email",
"time": "48ms"
}
403: Forbidden
{
"payload": [],
"message": "forbidden: authentication failed",
"code": "forbidden",
"time": "7ms"
}
404: Not Found
//branch
{
"payload": {
"errors": [
"branch not found"
]
},
"message": "branch not found",
"code": "not_found",
"time": "70ms"
}
500: Internal Server Error
{
"payload": [],
"message": "",
"code": "internal_error",
"time": "72ms"

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

Bash
PHP
python3
Bash
curl -X DELETE \
https://api.woowup.com/apiv3/purchases/bulk \
-H 'Accept: application/json' \
-H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{
"from": "2019-07-01",
"to": "2019-07-31",
"notify_to": "test@email.com"
}'
PHP
<?php
$curl = curl_init();
$payload = [
"from" => "2019-07-01",
"to" => "2019-07-31",
"notify_to" => "test@noemail.com",
];
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.woowup.com/apiv3/purchases/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Basic XXXXXXXXXXXXXXXXXXXX",
"Content-Type: application/json",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
python3
import requests
url = "https://api.woowup.com/apiv3/purchases/bulk"
payload = {
"from": "2019-07-01",
"to": "2019-07-31",
"notify_to": "test@noemail.com"
}
headers = {
'Accept': "application/json",
'Authorization': "Basic XXXXXXXXXXXXXXXXXXXX",
'Content-Type': "application/json",
'cache-control': "no-cache"
}
response = requests.request("DELETE", url, data=payload, headers=headers)
print(response.text)

Response

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

Practical example

Let's say we have unwanted purchases in a certain period of time and/or assigned to a particular branch, so we wan't to delete them. What else do we need? An email to notify after the delete has finished and the account's Api Key (where do I get that?). 1) First thing we are going to do is transform our start and end date to UTC time. If you wan't to delete a whole branch's sales skip this step. For example we want to delete the whole month of August 2019 in Colombia, the timezone of which is UTC-5. So the start date is 2019-08-01 00:00:00-05:00. Converted the timezone to UTC, it will be 2019-08-01 05:00:00. Then the end date converted will be 2019-09-01 04:59:59 (that is Colombia's 2019-08-31 23:59:59) 2) Now let's define the branch. If you want to delete purchases for a period of time no matter what branch they belong to, skip this step. Now we want to delete the purchases for the branch called "Example Store" (where can I see the full list of branches?). At the admin, if we open a branch, we will get the following window:

What we need is the Code ("001" in this example). That is what is going to fill in the 'branch_name' field. 3) We are ready to build and send our request. Let's say our account's apikey is "abcdefghij" and the email we want to notify after deletion is complete is "test@example.com". The request's cURL will go:

curl -X DELETE \
https://api.woowup.com/apiv3/purchases/bulk \
-H 'Accept: application/json' \
-H 'Authorization: Basic abcdefghij' \
-H 'Content-Type: application/json' \
-d '{
"from": "2019-08-01 05:00:00",
"to": "2019-09-01 04:59:59",
"branch_name": "001",
"notify_to": "test@email.com"
}'

Note: if you just wan't to delete purchases for a certain period of time, ignore the 'branch_name' field, and if you just wan't to delete a complete branch's orders, ignore 'from' and 'to' fields. To send the request you can use any software that executes cURL commands (Postman for example).