v1 (obsolète)
Demande de remboursement
Refund an amount by order, either partial or in full. An example use-case is when an order was captured but the customer returned item(s) that requires them to be refunded.
POST
/
v1
/
orders
/
{order_reference_id}
/
refund
Refund Request
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"refund_id": "41a2O9Lv-7",
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_reason": "Item returned by user"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund"
payload = {
"refund_id": "41a2O9Lv-7",
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_reason": "Item returned by user"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
refund_id: '41a2O9Lv-7',
amount: {amount_in_cents: 500, currency: 'USD'},
refund_reason: 'Item returned by user'
})
};
fetch('https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_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([
'refund_id' => '41a2O9Lv-7',
'amount' => [
'amount_in_cents' => 500,
'currency' => 'USD'
],
'refund_reason' => 'Item returned by user'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund"
payload := strings.NewReader("{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}"
response = http.request(request)
puts response.read_body{
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_id": "41a2O9Lv-7",
"refund_reason": "Item returned by user"
}{
"status": 400,
"id": "bad_request",
"message": "bad request"
}{
"status": 401,
"id": "unauthorized",
"message": "authorization not accepted"
}{
"status": 404,
"id": "record_not_found",
"message": "not found"
}{
"status": 422,
"id": "invalid",
"message": "Unprocessable entity"
}Vous consultez la Version 1 de l’API Sezzle. Découvrez la version actuelle!
Autorisations
The authentication token generated from providing API Keys to Sezzle Gateway
Paramètres de chemin
The Order Reference ID to update
Corps
application/json
A price object that defines the amount to be refunded. Amount may not be 0, negative, or exceed the total order amount. Currency must either be the order’s currency or the customer’s paying currency. This field is optional if the is_full_refund parameter is true.
UUID for the Refund. Must be unique to a Merchant
A reason for the refund
Overrides amount. If true, the order will be fully refunded. If omitted, will default to false.
Réponse
Successful Operation
⌘I
Refund Request
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"refund_id": "41a2O9Lv-7",
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_reason": "Item returned by user"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund"
payload = {
"refund_id": "41a2O9Lv-7",
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_reason": "Item returned by user"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
refund_id: '41a2O9Lv-7',
amount: {amount_in_cents: 500, currency: 'USD'},
refund_reason: 'Item returned by user'
})
};
fetch('https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_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([
'refund_id' => '41a2O9Lv-7',
'amount' => [
'amount_in_cents' => 500,
'currency' => 'USD'
],
'refund_reason' => 'Item returned by user'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund"
payload := strings.NewReader("{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v1/orders/{order_reference_id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"refund_id\": \"41a2O9Lv-7\",\n \"amount\": {\n \"amount_in_cents\": 500,\n \"currency\": \"USD\"\n },\n \"refund_reason\": \"Item returned by user\"\n}"
response = http.request(request)
puts response.read_body{
"amount": {
"amount_in_cents": 500,
"currency": "USD"
},
"refund_id": "41a2O9Lv-7",
"refund_reason": "Item returned by user"
}{
"status": 400,
"id": "bad_request",
"message": "bad request"
}{
"status": 401,
"id": "unauthorized",
"message": "authorization not accepted"
}{
"status": 404,
"id": "record_not_found",
"message": "not found"
}{
"status": 422,
"id": "invalid",
"message": "Unprocessable entity"
}