Commandes
Capturer un montant par commande
Capture an amount by order, either in full or partial capture, in cases when the order items are shipped separately.
Can be performed after shopper has authorized the transaction by completing checkout with Sezzle, but before authorization expires
POST
/
v2
/
order
/
{order_uuid}
/
capture
Capture amount by order
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"capture_amount": {
"amount_in_cents": 5000,
"currency": "USD"
}
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture"
payload = { "capture_amount": {
"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({capture_amount: {amount_in_cents: 5000, currency: 'USD'}})
};
fetch('https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture', 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}/capture",
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([
'capture_amount' => [
'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}/capture"
payload := strings.NewReader("{\n \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\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}/capture")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture")
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 \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\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"
}
]Autorisations
En-têtes
Paramètres de chemin
Corps
application/json
⌘I
Capture amount by order
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"capture_amount": {
"amount_in_cents": 5000,
"currency": "USD"
}
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture"
payload = { "capture_amount": {
"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({capture_amount: {amount_in_cents: 5000, currency: 'USD'}})
};
fetch('https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture', 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}/capture",
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([
'capture_amount' => [
'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}/capture"
payload := strings.NewReader("{\n \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\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}/capture")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/order/{order_uuid}/capture")
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 \"capture_amount\": {\n \"amount_in_cents\": 5000,\n \"currency\": \"USD\"\n }\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"
}
]