Order API

Creation

Capture

A capture must be made when the product or products are sent with the import of the total price of the sale. The amount of the capture must be the total amount of the order less total amount of the canceled items.

{
    "amount": 10050,
    "id": "cf04aa87a6364f14b164e48a84e99936",
    "created": "2019-06-21T16:51:19.494155+02:00",
    "refunds": [],
    "refunded_amount": 0,
    "remaining_amount": 0
}
Parameter Type Required Description
amount decimal yes Capture amount
id string yes Your capture ID
created string yes Date of the capture
refunds object no Refunds on capture done
refunded_amount decimal yes Refunded capture amount
remaining_amount decimal yes Remaining capture amount (It will always be 0)

01. Capture detail

GET /orders/:orderId/captures HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Order ID.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
    "remaining_capture_amount": 60020,
    "results": [
        {
            "amount": 10050,
            "id": "cf04aa87a6364f14b164e48a84e99936",
            "created": "2019-06-21T16:51:19.494155+02:00",
            "refunds": [],
            "refunded_amount": 0,
            "remaining_amount": 10050
        }
    ]
}
Parameter Type Description
remaining_capture_amount decimal Remaining order amount without capture (It will always be 0)
results object Captures of order

02. Request capture

POST /orders/:orderId/captures HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

{
  "amount": 10050
}
Parameter Type Required Description
:orderId string yes Order ID.
amount decimal yes Amount to capture

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
    "remaining_capture_amount": 49970,
    "amount": 10050,
    "id": "cf04aa87a6364f14b164e48a84e99936",
    "created": "2019-06-21T16:51:19.494155+02:00",
    "refunds": [],
    "refunded_amount": 0,
    "remaining_amount": 10050
}
Parameter Type Description
remaining_capture_amount decimal Remaining order amount without capture (It will always be 0)
amount decimal Capture amount
id string Your capture ID
created string Date of the capture
refunds object Refunds on capture done
refunded_amount decimal Refunded capture amount
remaining_amount decimal Remaining capture amount (It will always be 0)

Details

GET /orders/:orderId HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Order ID.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
  "id": ":orderId",
  "...": "..."
}

Edit

PUT /orders/:orderId HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Content-Type: application/json

{
  "order": {
    "shipping": {
      "first_name": "Django",
      "last_name": "Reinhard",
      "phone": "616123456",
      "alt_phone": "+34917909930",
      "street": "Plaza del Angel nº10",
      "address_addition": "Cerca de la plaza Santa Ana",
      "city": "Madrid",
      "state": "Madrid",
      "country": "ES",
      "postcode": "28012",
      "price": 500,
      "tax_rate": 2100,
      "name": "Planet Express",
      "discount": 100
    },
    "articles": [
      {
        "id": "59825349042875546873",
        "name": "N°5 eau premiere spray",
        "description": "A decidedly lighter, fresher...",
        "url": "http://www.chanel.com/fragrance-beauty/Fragrance-N05-88145/sku/138083",
        "image_url": "http://www.chanel.com/fragrance-beauty/Fragrance-N05-88145/sku/138083/product_01.jpg",
        "quantity": 1,
        "price": 29000,
        "tax_rate": 2100
      }
    ],
    "discount": 300,
    "currency": "EUR",
    "total_amount": 31080
  }
}
Parameter Type Required Description
:orderId string yes Order ID.
order object yes Order to update

Response

HTTP/1.1 204 No Content
X-Aplazame-Media-Type: aplazame.v1

Partial edit

PATCH /orders/:orderId HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Content-Type: application/json

{
  "order": {
    "articles": [
      {
        "id": "59825349042875546873",
        "name": "N°5 eau premiere spray",
        "description": "A decidedly lighter, fresher...",
        "url": "http://www.chanel.com/fragrance-beauty/Fragrance-N05-88145/sku/138083",
        "image_url": "http://www.chanel.com/fragrance-beauty/Fragrance-N05-88145/sku/138083/product_01.jpg",
        "quantity": 1,
        "price": 29000,
        "tax_rate": 2100
      }
    ],
    "discount": 300
  }
}
Parameter Type Required Description
:orderId string yes Order ID.
order object Partial Order to update

Response

HTTP/1.1 204 No Content
X-Aplazame-Media-Type: aplazame.v1

List

GET /orders HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
  "cursor": {
    "after": 3,
    "before": 1
  },
  "paging": {
    "count": 314,
    "next": "https://api.aplazame.com/orders?page=3",
    "previous": "https://api.aplazame.com/orders?page=1"
  },
  "results": [
  ]
}
Parameter Type Description
cursor object Pagination cursor object
paging object Pagination status
results collection List of stores

Void

An order accepts several partial voids only if the sum of the amount does not exceed the total of the original order. If the total amount is void, the order will be canceled.

01. Check voids

GET /orders/:orderId/void HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Order ID.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
   "remaining_amount":60020,
   "results":[
      {
         "amount":1000,
         "id":"7b596c68e9044737a838d54b9e7971a3",
         "created":"2020-10-09T13:56:09.043797+02:00"
      },
      {
         "amount":500,
         "id":"e07b9d47a72c4c7d8c9fc0c0bb2ba9b9",
         "created":"2020-10-09T13:59:05.697921+02:00"
      }
   ]
}
Parameter Type Description
remaining_amount decimal Remaining capture amount
results collection List of voids

02. Request void

POST /orders/:orderId/void HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

{
  "amount": 10050
}
Parameter Type Required Description
:orderId string yes Order ID.
amount decimal yes Amount to void

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
   "remaining_amount":60020,
   "results":[
      {
         "amount":1000,
         "id":"7b596c68e9044737a838d54b9e7971a3",
         "created":"2020-10-09T13:56:09.043797+02:00"
      },
      {
         "amount":500,
         "id":"e07b9d47a72c4c7d8c9fc0c0bb2ba9b9",
         "created":"2020-10-09T13:59:05.697921+02:00"
      }
   ]
}
Parameter Type Description
remaining_amount decimal Remaining capture amount
results collection List of voids

Refund

To make a refund, It will be done in one way or another depending on the type of operation

Check remaining amount

Refund online financing

An order accepts several partial returns only if the sum of the amount does not exceed the total of the original order. If the total amount is refunded, the order will be canceled.

Each partial refund operation affects the amount of future loan instalments. The amount of the refund will be reflected in the store’s commercial transactions and may include a refund of the amount to the buyer.

01. Check remaining amount

GET /orders/:orderId/refund HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Capture ID.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
  "remaining_amount": 70070
}

02. Request refund

POST /orders/:orderId/refund HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

{
  "amount": 10050
}
Parameter Type Required Description
:orderId string yes Order ID.
amount decimal yes Amount to refund

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
  "remaining_amount": 60020
}
Parameter Type Description
remaining_amount decimal Remaining capture amount

Check remaining amount

The refund is made at the capture level within an order. Being possible the refund of several captures.

A capture of an order accepts several partial refunds only if the sum of the amount does not exceed the total of the original capture.

{
    "id": "db654bf752a84b7eaf6fcb7ab5801f60",
    "amount": 10050,
    "pending_amount": 0,
    "accrual_date": "2019-06-21",
    "credit_to_customer": 0,
    "completed": false,
    "completed_but_defaults": false,
    "created": "2019-06-21T16:52:07.733892+02:00"
}
Parameter Type Required Description
id string yes Your refund ID
amount decimal yes Refund amount
pending_amount decimal yes Remaining capture amount
accrual_date string yes Effective date of refund
credit_to_customer decimal yes Refund amount to customer
completed boolean yes Order completed
completed_but_defaults boolean yes Order completed but with defaults
created string yes Date of refund

01. Check remaining amount

GET /orders/:orderId/captures/:captureId/refunds HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Capture ID.
:captureId string yes Capture ID.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
    "amount": 70070,
    "id": "cf04aa87a6364f14b164e48a84e99936",
    "created": "2019-06-21T16:51:19.494155+02:00",
    "refunds": [],
    "refunded_amount": 0,
    "remaining_amount": 70070
}
Parameter Type Description
amount decimal Capture amount
id string Your capture ID
created string Date of the capture
refunds object Refunds on capture done
refunded_amount decimal Remaining capture amount
remaining_amount decimal Remaining capture amount

02. Request refund

POST /orders/:orderId/captures/:captureId/refunds HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

{
  "amount": 10050
}
Parameter Type Required Description
:orderId string yes Order ID.
:captureId string yes Capture ID.
amount decimal yes Amount to refund

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

{
    "amount": 70070,
    "id": "cf04aa87a6364f14b164e48a84e99936",
    "created": "2019-06-21T16:51:19.494155+02:00",
    "refunds": [
        {
            "id": "db654bf752a84b7eaf6fcb7ab5801f60",
            "amount": 10050,
            "pending_amount": 60020,
            "accrual_date": "2019-06-21",
            "credit_to_customer": 0,
            "completed": false,
            "completed_but_defaults": false,
            "created": "2019-06-21T16:52:07.733892+02:00"
        }
    ],
    "refunded_amount": 10050,
    "remaining_amount": 60020
}
Parameter Type Description
amount decimal Capture amount
id string Your capture ID
created string Date of the capture
refunds object Refunds on capture done
refunded_amount decimal Remaining capture amount
remaining_amount decimal Remaining capture amount

Cancellation

Once the order has been cancelled, it cannot be modified.

The cancellation amount will show up in the store’s commercial transactions and a full refund will be given for the amounts previously paid by the buyer.

POST /orders/:orderId/cancel HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Parameter Type Required Description
:orderId string yes Order ID.

Response

HTTP/1.1 204 No Content
X-Aplazame-Media-Type: aplazame.v1

History

It is recommended that this be sent asynchronously so as not to delay the loading of the template.

POST /orders/:orderId/history HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Content-Type: application/json

[{
  "id": "18857527248912279381",
  "amount": 12080,
  "due": "",
  "status": "cancelled",
  "type": "paypal",
  "order_date": "2014-03-21T13:56:45+0000",
  "currency": "EUR",
  "billing": null,
  "shipping": {
    "first_name": "Django",
    "last_name": "Reinhard",
    "phone": "616123456",
    "alt_phone": "+34917909930",
    "street": "Plaza del Angel nº10",
    "address_addition": "Cerca de la plaza Santa Ana",
    "city": "Madrid",
    "state": "Madrid",
    "country": "ES",
    "postcode": "28012",
    "price": 500,
    "tax_rate": 2100,
    "name": "Planet Express",
    "discount": 100
  }
}]
Parameter Type Required Description
:orderId string yes Your order ID
id string yes Your order ID
amount decimal yes Order amount
due decimal no Total order amount due
status string yes Order status; the choices are pending, cancelled, processing and complete
type string yes Order type
order_date string yes Date of the order
currency ISO 4217 yes Currency code of the order
billing object no Billing address
shipping object no Shipping info

Response

HTTP/1.1 204 No Content
X-Aplazame-Media-Type: aplazame.v1