Refund orders
Refund requests are only accepted for confirmed orders.
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
- http
- shell
- python
- php
- C#
GET /orders/:orderId/refund HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
$ curl "https://api.aplazame.com/orders/:orderId/refund" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.refund_check(':orderId')
<?php
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, " api_private_key");
$result = $aplazameClient->get("/orders/{$orderId}/refund");
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, " api_private_key");
dynamic result = client.Get($"/orders/{orderId}/refund");
| Parameter | Type | Required | Description |
|---|---|---|---|
| :orderId | string | Sí | Order 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
- http
- shell
- python
- php
- C#
POST /orders/:orderId/refund HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
{
"amount": 10050
}
$ curl "https://api.aplazame.com/orders/:orderId/refund" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key" \
-X POST \
-d "amount=10050"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.refund(':orderId', 10050)
<?php
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, " api_private_key");
$result = $aplazameClient->post("/orders/{$orderId}/refund", ["amount" => Aplazame\Serializer\Decimal::fromFloat(100.50)->value]);
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, " api_private_key");
dynamic result = client.Post($"/orders/{orderId}/refund", new {amount = Aplazame.Serializer.DecimalType.FromDouble(100.50)});
| Parameter | Type | Required | Description |
|---|---|---|---|
| :orderId | string | Sí | Order ID. |
| amount | decimal | Sí | 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 |
| results | collection | List of voids |
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 | Sí | Your refund ID. |
| amount | decimal | Sí | Refund amount. |
| pending_amount | decimal | Sí | Remaining capture amount. |
| accrual_date | string | Sí | Effective date of refund. |
| credit_to_customer | decimal | Sí | Refund amount to customer. |
| completed | boolean | Sí | Order completed. |
| completed_but_defaults | boolean | Sí | Order completed but with defaults. |
| created | string | Sí | Date of refund. |
01 - Check remaining amount
- http
- shell
- python
- php
- C#
GET /orders/:orderId/captures/:captureId/refunds HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
$ curl "https://api.aplazame.com/orders/:orderId/captures/:captureId/refunds" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.get_capture_refund(':orderId', ':captureId')
<?php
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, " api_private_key");
$result = $aplazameClient->get("/orders/{$orderId}/captures/{$captureId}/refunds");
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, " api_private_key");
dynamic result = client.Get($"/orders/{orderId}/captures/{captureId}/refunds");
| Parameter | Type | Required | Description |
|---|---|---|---|
| :orderId | string | Sí | Order ID. |
| :captureId | string | Sí | ID de la captura. |
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 | Refunded capture amount |
| remaining_amount | decimal | Remaining capture amount (It will always be 0) |
02 - Request refund
- http
- shell
- python
- php
- C#
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
}
$ curl "https://api.aplazame.com/orders/:orderId/captures/:captureId/refunds" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key" \
-X POST \
-d "amount=10050"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.capture_refund(':orderId', ':captureId', 10050)
<?php
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, " api_private_key");
$result = $aplazameClient->post("/orders/{$orderId}/captures/{$captureId}/refunds", ["amount" => Aplazame\Serializer\Decimal::fromFloat(100.50)->value]);
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, " api_private_key");
dynamic result = client.Post($"/orders/{orderId}/captures/{captureId}/refunds", new {amount = Aplazame.Serializer.DecimalType.FromDouble(100.50)});
| Parameter | Type | Required | Description |
|---|---|---|---|
| :orderId | string | Sí | Order ID. |
| :captureId | string | Sí | Capture ID. |
| amount | decimal | Sí | 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. |