Orders
Refund amount by order
Refund an amount by order. An example use-case is when an order was captured but the customer returned item(s) that requires them to be refunded.
Can be performed after order capture.
POST
/
v2
/
order
/
{order_uuid}
/
refund
Refund amount by order
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/refund \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_in_cents": 5000,
"currency": "USD"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/refund"
payload = {
"amount_in_cents": 5000,
"currency": "USD"
}
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({amount_in_cents: 5000, currency: 'USD'})
};
fetch('https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/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/v2/order/{order_uuid}/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_in_cents' => 5000,
'currency' => 'USD'
]),
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/v2/order/{order_uuid}/refund"
payload := strings.NewReader("{\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\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/v2/order/{order_uuid}/refund")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/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 \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "6c9db5d4-d09a-4224-860a-b5438ac32ca8"
}[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]Authorizations
The authentication token generated from providing API Keys to Sezzle Gateway
Headers
Unique client-generated ID to enforce idempotency
Path Parameters
The Order UUID to refund (order.uuid from session response)
Body
application/json
The amount to be refunded
Response
Successful Operation
The uuid returned from this operation is the refund transaction uuid, but there are no endpoints that use this value. You may retrieve an order's refund transactions using the Get an order endpoint.
⌘I
Refund amount by order
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/refund \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_in_cents": 5000,
"currency": "USD"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/refund"
payload = {
"amount_in_cents": 5000,
"currency": "USD"
}
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({amount_in_cents: 5000, currency: 'USD'})
};
fetch('https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/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/v2/order/{order_uuid}/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_in_cents' => 5000,
'currency' => 'USD'
]),
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/v2/order/{order_uuid}/refund"
payload := strings.NewReader("{\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\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/v2/order/{order_uuid}/refund")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/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 \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "6c9db5d4-d09a-4224-860a-b5438ac32ca8"
}[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]