Cancelar o extornar operacion ecommerce
curl --request DELETE \
--url https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number} \
--header 'ALG-API-VERSION: <alg-api-version>' \
--header 'Authorization: <authorization>'import requests
url = "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}"
headers = {
"Authorization": "<authorization>",
"ALG-API-VERSION": "<alg-api-version>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: '<authorization>', 'ALG-API-VERSION': '<alg-api-version>'}
};
fetch('https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"ALG-API-VERSION: <alg-api-version>",
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("ALG-API-VERSION", "<alg-api-version>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}")
.header("Authorization", "<authorization>")
.header("ALG-API-VERSION", "<alg-api-version>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
request["ALG-API-VERSION"] = '<alg-api-version>'
response = http.request(request)
puts response.read_body{
"success": true,
"merchant_code": "abc",
"merchant_operation_number": "2836824",
"operation": {
"merchant_operation_number": "2836824",
"amount": "1000",
"currency": "604",
"created_at": {
"utc_time": "2024-07-05T16:46:12",
"unix_time": 1720197972
},
"state": "CANCELADO",
"transactions": [
{
"transaction_id": "9namjcnjvqzas2t33xyfrqr2h",
"channel": "ecommerce",
"state": "CANCELADO",
"state_reason": "Usuario cancelo el metodo de pago",
"amount": "1000",
"currency": "604",
"additional_fields": null,
"payment_method": {
"method_name": "PAGOEFECTIVO",
"method_details": {
"callback_url": "https://jjap9ekgee.execute-api.us-east-1.amazonaws.com/development/redirect/prueba/merchant_notification_response"
}
},
"expiration_date": null,
"processor_response": null,
"lifecycle": [
{
"state": "REGISTRADO",
"date": {
"utc_time": "2024-07-05T16:46:12",
"unix_time": 1720197972
}
},
{
"state": "PENDIENTE",
"date": {
"utc_time": "2024-07-05T16:46:13",
"unix_time": 1720197973
}
},
{
"state": "CANCELADO",
"date": {
"utc_time": "2024-07-05T16:47:22",
"unix_time": 1720198042
}
}
]
}
]
},
"meta": {
"status": {
"code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Se proceso correctamente la peticion"
}
]
}
}
}PayIn
Cancelar o extornar operacion ecommerce
Cancela o extorna una transaccion generada previamente por el API de autorizacion.
Con el metodo DELETE del orquestador, las transacciones se podran cancelar o extornar segun el estado en el que se encuentran. Las transacciones en estado REGISTRADO o PENDIENTE pasan a CANCELADO para CARD cuando es por Redirect, CUOTEALO, QR, BANK_TRANSFER y PAGOEFECTIVO. Las transacciones en estado AUTORIZADO pasan a EXTORNADO para CARD y YAPE.
DELETE
/
charges
/
{merchant_code}
/
{merchant_operation_number}
Cancelar o extornar operacion ecommerce
curl --request DELETE \
--url https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number} \
--header 'ALG-API-VERSION: <alg-api-version>' \
--header 'Authorization: <authorization>'import requests
url = "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}"
headers = {
"Authorization": "<authorization>",
"ALG-API-VERSION": "<alg-api-version>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: '<authorization>', 'ALG-API-VERSION': '<alg-api-version>'}
};
fetch('https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"ALG-API-VERSION: <alg-api-version>",
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("ALG-API-VERSION", "<alg-api-version>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}")
.header("Authorization", "<authorization>")
.header("ALG-API-VERSION", "<alg-api-version>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.preprod.alignet.io/charges/{merchant_code}/{merchant_operation_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
request["ALG-API-VERSION"] = '<alg-api-version>'
response = http.request(request)
puts response.read_body{
"success": true,
"merchant_code": "abc",
"merchant_operation_number": "2836824",
"operation": {
"merchant_operation_number": "2836824",
"amount": "1000",
"currency": "604",
"created_at": {
"utc_time": "2024-07-05T16:46:12",
"unix_time": 1720197972
},
"state": "CANCELADO",
"transactions": [
{
"transaction_id": "9namjcnjvqzas2t33xyfrqr2h",
"channel": "ecommerce",
"state": "CANCELADO",
"state_reason": "Usuario cancelo el metodo de pago",
"amount": "1000",
"currency": "604",
"additional_fields": null,
"payment_method": {
"method_name": "PAGOEFECTIVO",
"method_details": {
"callback_url": "https://jjap9ekgee.execute-api.us-east-1.amazonaws.com/development/redirect/prueba/merchant_notification_response"
}
},
"expiration_date": null,
"processor_response": null,
"lifecycle": [
{
"state": "REGISTRADO",
"date": {
"utc_time": "2024-07-05T16:46:12",
"unix_time": 1720197972
}
},
{
"state": "PENDIENTE",
"date": {
"utc_time": "2024-07-05T16:46:13",
"unix_time": 1720197973
}
},
{
"state": "CANCELADO",
"date": {
"utc_time": "2024-07-05T16:47:22",
"unix_time": 1720198042
}
}
]
}
]
},
"meta": {
"status": {
"code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Se proceso correctamente la peticion"
}
]
}
}
}Headers
Token Bearer obtenido desde autenticacion.
Version del API a usar.
Identificador del Facilitador de Pago.
Path Parameters
Identificador del comercio.
Numero de operacion registrado por el comercio.
⌘I

