curl --request POST \
--url https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"amount": 50
}'import requests
url = "https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund"
payload = { "amount": 50 }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 50})
};
fetch('https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund', 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.sandbox.cheqpay.mx/lps/invoices/{id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund"
payload := strings.NewReader("{\n \"amount\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"customerId": "<string>",
"merchantId": "<string>",
"paymentOrderId": "<string>",
"paymentLinkId": "<string>",
"reference": "<string>",
"externalId": "<string>",
"orderNumber": "<string>",
"invoiceNumber": "<string>",
"products": [
{
"name": "<string>",
"qty": 2,
"price": 1,
"total": 1,
"id": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"isQtyAdjustable": true,
"minQty": 123,
"maxQty": 123
}
],
"totals": {
"total": 123,
"subtotal": 123,
"taxes": 123,
"shipping": 123,
"fees": 123,
"discounts": 123,
"surcharge": 123,
"surchargeRate": 123
},
"billingAddress": {
"firstName": "<string>",
"lastName": "<string>",
"organizationName": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"addressLine1": "<string>",
"addressLine2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"isSameAsShipping": true
},
"shippingAddress": {
"firstName": "<string>",
"lastName": "<string>",
"organizationName": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"addressLine1": "<string>",
"addressLine2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>"
},
"paymentMethod": {
"type": "card",
"card": {
"bin": "<string>",
"brand": "<string>",
"country": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"issuerBank": "<string>",
"last4": "<string>",
"type": "<string>"
},
"spei": {
"clabe": "<string>"
},
"cieCashNet": {
"reference": "CIE0000000001",
"convenio": "0123456789",
"clabe": "012345678901234567"
}
},
"status": "pending",
"customFields": [
{
"label": "<string>",
"type": "text",
"value": "<string>"
}
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "Resource not found"
}{
"message": "Internal server error"
}Refund invoice
Refund an invoice by ID. The refund is delegated to the underlying payment order. Multiple partial refunds are supported up to the invoice amount.
curl --request POST \
--url https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"amount": 50
}'import requests
url = "https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund"
payload = { "amount": 50 }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 50})
};
fetch('https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund', 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.sandbox.cheqpay.mx/lps/invoices/{id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund"
payload := strings.NewReader("{\n \"amount\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/lps/invoices/{id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"customerId": "<string>",
"merchantId": "<string>",
"paymentOrderId": "<string>",
"paymentLinkId": "<string>",
"reference": "<string>",
"externalId": "<string>",
"orderNumber": "<string>",
"invoiceNumber": "<string>",
"products": [
{
"name": "<string>",
"qty": 2,
"price": 1,
"total": 1,
"id": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"isQtyAdjustable": true,
"minQty": 123,
"maxQty": 123
}
],
"totals": {
"total": 123,
"subtotal": 123,
"taxes": 123,
"shipping": 123,
"fees": 123,
"discounts": 123,
"surcharge": 123,
"surchargeRate": 123
},
"billingAddress": {
"firstName": "<string>",
"lastName": "<string>",
"organizationName": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"addressLine1": "<string>",
"addressLine2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"isSameAsShipping": true
},
"shippingAddress": {
"firstName": "<string>",
"lastName": "<string>",
"organizationName": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"addressLine1": "<string>",
"addressLine2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>"
},
"paymentMethod": {
"type": "card",
"card": {
"bin": "<string>",
"brand": "<string>",
"country": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"issuerBank": "<string>",
"last4": "<string>",
"type": "<string>"
},
"spei": {
"clabe": "<string>"
},
"cieCashNet": {
"reference": "CIE0000000001",
"convenio": "0123456789",
"clabe": "012345678901234567"
}
},
"status": "pending",
"customFields": [
{
"label": "<string>",
"type": "text",
"value": "<string>"
}
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "Resource not found"
}{
"message": "Internal server error"
}Authorizations
API key for merchant authentication
Path Parameters
Invoice ID (MongoDB ObjectId)
^[a-f\d]{24}$Body
Amount to refund, in major currency units (e.g. 50 = $50.00 MXN). Must be positive. Pass the full invoice amount for a full refund.
50
Response
Invoice refunded successfully
Invoice details
Invoice ID
Customer ID
Merchant ID
^[a-f\d]{24}$Payment order ID
Payment link ID
Merchant reference
Merchant reference
Order number
Merchant-provided invoice number; shown to customers instead of orderNumber when present
Products in the invoice
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Address information
Show child attributes
Show child attributes
Address information
Show child attributes
Show child attributes
Payment method details
Show child attributes
Show child attributes
Invoice status
pending, paid, cancelled, refunded, failed, abandoned Snapshot of the customer-submitted answers for the payment link's custom fields
Show child attributes
Show child attributes
Additional metadata
Creation timestamp
Last update timestamp