Create a session
Initiate a Sezzle session with shopper order details, redirect links, and capture and tokenization settings. A session must carry an order, tokenize a customer, or both. Omit the order and set customer.tokenize to true for standalone tokenization, which returns tokenize.approval_url instead of an order.
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/session \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"cancel_url": {
"href": "https://example.com/cart",
"method": "GET"
},
"complete_url": {
"href": "https://example.com/ord_12345/complete",
"method": "GET"
},
"customer": {
"email": "john.doe@sezzle.com",
"first_name": "John",
"last_name": "Doe",
"phone": "5555045294",
"dob": "1990-02-25",
"billing_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
},
"shipping_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
}
},
"order": {
"intent": "CAPTURE",
"reference_id": "ord_12345",
"description": "sezzle-store - #12749253509255",
"items": [
{
"name": "widget",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"discounts": [
{
"name": "20% off",
"amount": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"metadata": {
"location_id": "123",
"store_name": "Downtown Minneapolis",
"store_manager": "Jane Doe"
},
"shipping_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"tax_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"order_amount": {
"amount_in_cents": 10000,
"currency": "USD"
}
}
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/session"
payload = {
"cancel_url": {
"href": "https://example.com/cart",
"method": "GET"
},
"complete_url": {
"href": "https://example.com/ord_12345/complete",
"method": "GET"
},
"customer": {
"email": "john.doe@sezzle.com",
"first_name": "John",
"last_name": "Doe",
"phone": "5555045294",
"dob": "1990-02-25",
"billing_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
},
"shipping_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
}
},
"order": {
"intent": "CAPTURE",
"reference_id": "ord_12345",
"description": "sezzle-store - #12749253509255",
"items": [
{
"name": "widget",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"discounts": [
{
"name": "20% off",
"amount": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"metadata": {
"location_id": "123",
"store_name": "Downtown Minneapolis",
"store_manager": "Jane Doe"
},
"shipping_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"tax_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"order_amount": {
"amount_in_cents": 10000,
"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({
cancel_url: {href: 'https://example.com/cart', method: 'GET'},
complete_url: {href: 'https://example.com/ord_12345/complete', method: 'GET'},
customer: {
email: 'john.doe@sezzle.com',
first_name: 'John',
last_name: 'Doe',
phone: '5555045294',
dob: '1990-02-25',
billing_address: {
name: 'John Doe',
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US',
phone_number: '5555045294'
},
shipping_address: {
name: 'John Doe',
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US',
phone_number: '5555045294'
}
},
order: {
intent: 'CAPTURE',
reference_id: 'ord_12345',
description: 'sezzle-store - #12749253509255',
items: [
{
name: 'widget',
sku: 'sku123456',
quantity: 1,
price: {amount_in_cents: 1000, currency: 'USD'}
}
],
discounts: [{name: '20% off', amount: {amount_in_cents: 1000, currency: 'USD'}}],
metadata: {
location_id: '123',
store_name: 'Downtown Minneapolis',
store_manager: 'Jane Doe'
},
shipping_amount: {amount_in_cents: 1000, currency: 'USD'},
tax_amount: {amount_in_cents: 1000, currency: 'USD'},
order_amount: {amount_in_cents: 10000, currency: 'USD'}
}
})
};
fetch('https://sandbox.gateway.sezzle.com/v2/session', 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/session",
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([
'cancel_url' => [
'href' => 'https://example.com/cart',
'method' => 'GET'
],
'complete_url' => [
'href' => 'https://example.com/ord_12345/complete',
'method' => 'GET'
],
'customer' => [
'email' => 'john.doe@sezzle.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '5555045294',
'dob' => '1990-02-25',
'billing_address' => [
'name' => 'John Doe',
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US',
'phone_number' => '5555045294'
],
'shipping_address' => [
'name' => 'John Doe',
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US',
'phone_number' => '5555045294'
]
],
'order' => [
'intent' => 'CAPTURE',
'reference_id' => 'ord_12345',
'description' => 'sezzle-store - #12749253509255',
'items' => [
[
'name' => 'widget',
'sku' => 'sku123456',
'quantity' => 1,
'price' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
]
]
],
'discounts' => [
[
'name' => '20% off',
'amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
]
]
],
'metadata' => [
'location_id' => '123',
'store_name' => 'Downtown Minneapolis',
'store_manager' => 'Jane Doe'
],
'shipping_amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
],
'tax_amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
],
'order_amount' => [
'amount_in_cents' => 10000,
'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/session"
payload := strings.NewReader("{\n \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\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/session")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/session")
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 \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "fadbc642-05a4-4e38-9e74-80e325623af9",
"links": [
{
"href": "https://gateway.sezzle.com/v2/session/fadbc642-05a4-4e38-9e74-80e325623af9",
"method": "GET",
"rel": "self"
}
],
"order": {
"uuid": "12a34bc5-6de7-890f-g123-4hi1238jk902",
"checkout_url": "https://checkout.sezzle.com/?id=12a34bc5-6de7-890f-g123-4hi1238jk902",
"intent": "CAPTURE",
"links": [
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902",
"method": "GET",
"rel": "self"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902",
"method": "PATCH",
"rel": "self"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/release",
"method": "POST",
"rel": "release"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/capture",
"method": "POST",
"rel": "capture"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/refund",
"method": "POST",
"rel": "refund"
}
]
}
}[
{
"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
Body
The HTTP request information used to redirect the customer upon completion of the session. Required for sessions that include an order and use redirect checkout, and for any session that tokenizes a customer — including standalone tokenization, where it is the destination the customer returns to after approving.
The HTTP request information used to redirect the customer in the case of a cancellation. Required for sessions that include an order and use redirect checkout. Optional for standalone tokenization sessions, which have no order to cancel — supply it only if you want a separate destination for customers who decline.
Customer details for this session. To optimize checkout and boost conversion, it is recommended to include as much customer information as possible.
Hide child attributes
Hide child attributes
The customer's first name
The customer's last name
The customer's email address
The customer's phone number
The customer's billing address
Hide child attributes
Hide child attributes
The name on the address
The street and number of the address
The apt or unit
The city
The 2 character state code
The postal delivery code
The 2 character country code
The phone number at the delivery location
The customer's shipping address. Merchants enrolled in Sezzle's Long Term Lending program (as well as general integrations) must send a Customer object that includes, at a minimum, a complete and valid shipping_address object. Post office box (i.e., P. O. Box) addresses are not accepted for this purpose. For more details, please contact your account manager.
Hide child attributes
Hide child attributes
The name on the address
The street and number of the address
The apt or unit
The city
The 2 character state code
The postal delivery code
The 2 character country code
The phone number at the delivery location
The customer's date of birth in YYYY-MM-DD format (parameter is input only)
Tokenizing a customer allows you to authorize future transactions on their behalf. If omitted, will default to false. To create an order and tokenize a customer in a single session, set customer.tokenize to true and provide an order object. The user will be prompted to accept tokenization during checkout. To tokenize a customer without a purchase (standalone tokenization), set customer.tokenize to true and omit the order object. The response returns tokenize.approval_url to redirect the customer to. Standalone tokenization is enabled per merchant — contact your account manager.
Indicates whether the tokenization is part of a recurring subscription. true - The token is associated with a subscription and will be reused for future charges. false - The token is for a one-time use, such as Pre-order or Single Tokenization.
Order ID, amount, and capture intent. Order details optional.
Hide child attributes
Hide child attributes
- Use CAPTURE if payment should be captured immediately upon shopper authorization
- Use AUTH if there is any post-authorization validation needed prior to capture, such as inventory validation or regulatory requirements, or if merchant policy is to charge the payment method at time of shipment
- Submit a capture request via the API or your Merchant Dashboard before the authorization expires.
- The authorization expiration window can be set from 30 minutes up to 7 days in your Merchant Dashboard Settings.
- If not specified, the value will default to CAPTURE
AUTH, CAPTURE The checkout or cart ID from the merchant, currently used for tracking only (must contain only alphanumeric characters, dashes (-), and underscores (_))
A Price object containing the total amount in cents of the order, which must be at least 100 which is $1.00. Please note your merchant configuration might have a higher minimum.
Your description for this order
The items being purchased
Hide child attributes
Hide child attributes
The name of the item
The sku identifier
The quantity purchased
The category path where the product is located. Use > only as the category delimiter, not as part of a product or category name. Example: Camping Gear & Supplies > Tents & Shelters.
The products brand name as customers would recognize. Examples: Nike, Kelty, Brooks, Carhartt, Columbia
The fully qualified URL that shows the image
The fully qualified URL that links directly to the product being purchased
The products Global Trade Item Number (GTIN). Common types include UPC, ISBN, EAN. Exclude dashes and spaces.
The products Manufacturer Part Number (MPN) which together with brand can uniquely identify a product.
Flag to indicate if you would like us to collect shipping information for this checkout from the customer. If omitted, defaults to false. Required for express checkout flow if express_checkout_type is single-step or multi-step.
The discounts applied to this order. Must be included in total
Hide child attributes
Hide child attributes
The mode for the order checkout. Defaults to redirect if not provided. If iframe or popup is provided, then the cancel and complete URLs must include the origin of the parent window.
iframe, popup, redirect A Notification object for sending checkout URL to the customer
Hide child attributes
Hide child attributes
The SMS phone number of the notification
The email address of the notification
The 2-character ISO 639 langauge code of the notification. Acceptable values are en and fr-CA. Will default to English if not provided.
en, fr-CA Localizes the checkout. Accepted values are en-US (English, United States), en-CA (English, Canada) and fr-CA (French, Canada). Defaults to en-US if not provided.
en-US, en-CA, fr-CA The financing options of the checkout. Only one option can be included.
currently not supported, defaults to 4-pay-biweekly
4-pay-biweekly, 4-pay-monthly, 6-pay-monthly - single-step: only one shipping method exists, or only use default shipping method for Sezzle express checkout flow
- multi-step: allow the user to select from merchant-supported shipping methods
- no-shipping: purchase contains no shippable items and shopper does not have option to select, such as digital download or buy online pick up in store (BOPIS).
single-step, multi-step, no-shipping Response
Successful Operation
The unique identifier for this response
Available API links prefilled with UUID with accompanying method
Hide child attributes
Hide child attributes
The fully qualified URL for the API endpoint
The relationship type indicating the purpose of this link (e.g., 'self' for the current resource, 'create' for creating a new resource, 'list' for listing resources)
self, capture, checkout, create, customer, list, order, preapprove, refund, release, session The HTTP method to use when calling this API endpoint
GET, POST, PATCH, DELETE Order metadata required for checkout
Hide child attributes
Hide child attributes
Unique identifier for this order
- Use CAPTURE if payment should be captured immediately upon shopper authorization
- Use AUTH if there is any post-authorization validation needed prior to capture, such as inventory validation or regulatory requirements, or if merchant policy is to charge the payment method at time of shipment
- Submit a capture request via the API or your Merchant Dashboard before the authorization expires.
- The authorization expiration window can be set from 30 minutes up to 7 days in your Merchant Dashboard Settings.
- If not specified, the value will default to CAPTURE
AUTH, CAPTURE The URL to which the shopper should be directed to complete their order with Sezzle
Available API links prefilled with UUID with accompanying method
Hide child attributes
Hide child attributes
The fully qualified URL for the API endpoint
The relationship type indicating the purpose of this link (e.g., 'self' for the current resource, 'create' for creating a new resource, 'list' for listing resources)
self, capture, checkout, create, customer, list, order, preapprove, refund, release, session The HTTP method to use when calling this API endpoint
GET, POST, PATCH, DELETE This is included in the response when starting a customer tokenization session.
Hide child attributes
Hide child attributes
This token represents the merchant request to tokenize a customer. This token can only be used one time. Once a user accepts/denies tokenization, this token and its approval URL will be obsolete.
The expiration of the request token in ISO 8601 date/time format.
The URL for the user to accept tokenization. This URL does not create an order and the customer is not charged; it is only used for tokenizing a customer. Returned only for standalone tokenization — a session with customer.tokenize set to true and no order object — and only for merchants who have standalone tokenization enabled. It is omitted for sessions that include an order, where the customer authorizes tokenization during checkout instead. The URL expires 30 minutes after the session is created, which is sooner than the expiration field above. Create the session at the moment the customer clicks to authorize.
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/session \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"cancel_url": {
"href": "https://example.com/cart",
"method": "GET"
},
"complete_url": {
"href": "https://example.com/ord_12345/complete",
"method": "GET"
},
"customer": {
"email": "john.doe@sezzle.com",
"first_name": "John",
"last_name": "Doe",
"phone": "5555045294",
"dob": "1990-02-25",
"billing_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
},
"shipping_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
}
},
"order": {
"intent": "CAPTURE",
"reference_id": "ord_12345",
"description": "sezzle-store - #12749253509255",
"items": [
{
"name": "widget",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"discounts": [
{
"name": "20% off",
"amount": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"metadata": {
"location_id": "123",
"store_name": "Downtown Minneapolis",
"store_manager": "Jane Doe"
},
"shipping_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"tax_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"order_amount": {
"amount_in_cents": 10000,
"currency": "USD"
}
}
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/session"
payload = {
"cancel_url": {
"href": "https://example.com/cart",
"method": "GET"
},
"complete_url": {
"href": "https://example.com/ord_12345/complete",
"method": "GET"
},
"customer": {
"email": "john.doe@sezzle.com",
"first_name": "John",
"last_name": "Doe",
"phone": "5555045294",
"dob": "1990-02-25",
"billing_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
},
"shipping_address": {
"name": "John Doe",
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US",
"phone_number": "5555045294"
}
},
"order": {
"intent": "CAPTURE",
"reference_id": "ord_12345",
"description": "sezzle-store - #12749253509255",
"items": [
{
"name": "widget",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"discounts": [
{
"name": "20% off",
"amount": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
],
"metadata": {
"location_id": "123",
"store_name": "Downtown Minneapolis",
"store_manager": "Jane Doe"
},
"shipping_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"tax_amount": {
"amount_in_cents": 1000,
"currency": "USD"
},
"order_amount": {
"amount_in_cents": 10000,
"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({
cancel_url: {href: 'https://example.com/cart', method: 'GET'},
complete_url: {href: 'https://example.com/ord_12345/complete', method: 'GET'},
customer: {
email: 'john.doe@sezzle.com',
first_name: 'John',
last_name: 'Doe',
phone: '5555045294',
dob: '1990-02-25',
billing_address: {
name: 'John Doe',
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US',
phone_number: '5555045294'
},
shipping_address: {
name: 'John Doe',
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US',
phone_number: '5555045294'
}
},
order: {
intent: 'CAPTURE',
reference_id: 'ord_12345',
description: 'sezzle-store - #12749253509255',
items: [
{
name: 'widget',
sku: 'sku123456',
quantity: 1,
price: {amount_in_cents: 1000, currency: 'USD'}
}
],
discounts: [{name: '20% off', amount: {amount_in_cents: 1000, currency: 'USD'}}],
metadata: {
location_id: '123',
store_name: 'Downtown Minneapolis',
store_manager: 'Jane Doe'
},
shipping_amount: {amount_in_cents: 1000, currency: 'USD'},
tax_amount: {amount_in_cents: 1000, currency: 'USD'},
order_amount: {amount_in_cents: 10000, currency: 'USD'}
}
})
};
fetch('https://sandbox.gateway.sezzle.com/v2/session', 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/session",
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([
'cancel_url' => [
'href' => 'https://example.com/cart',
'method' => 'GET'
],
'complete_url' => [
'href' => 'https://example.com/ord_12345/complete',
'method' => 'GET'
],
'customer' => [
'email' => 'john.doe@sezzle.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '5555045294',
'dob' => '1990-02-25',
'billing_address' => [
'name' => 'John Doe',
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US',
'phone_number' => '5555045294'
],
'shipping_address' => [
'name' => 'John Doe',
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US',
'phone_number' => '5555045294'
]
],
'order' => [
'intent' => 'CAPTURE',
'reference_id' => 'ord_12345',
'description' => 'sezzle-store - #12749253509255',
'items' => [
[
'name' => 'widget',
'sku' => 'sku123456',
'quantity' => 1,
'price' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
]
]
],
'discounts' => [
[
'name' => '20% off',
'amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
]
]
],
'metadata' => [
'location_id' => '123',
'store_name' => 'Downtown Minneapolis',
'store_manager' => 'Jane Doe'
],
'shipping_amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
],
'tax_amount' => [
'amount_in_cents' => 1000,
'currency' => 'USD'
],
'order_amount' => [
'amount_in_cents' => 10000,
'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/session"
payload := strings.NewReader("{\n \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\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/session")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/session")
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 \"cancel_url\": {\n \"href\": \"https://example.com/cart\",\n \"method\": \"GET\"\n },\n \"complete_url\": {\n \"href\": \"https://example.com/ord_12345/complete\",\n \"method\": \"GET\"\n },\n \"customer\": {\n \"email\": \"john.doe@sezzle.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"5555045294\",\n \"dob\": \"1990-02-25\",\n \"billing_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n },\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"street\": \"123 W Lake St\",\n \"street2\": \"Unit 104\",\n \"city\": \"Minneapolis\",\n \"state\": \"MN\",\n \"postal_code\": \"55408\",\n \"country_code\": \"US\",\n \"phone_number\": \"5555045294\"\n }\n },\n \"order\": {\n \"intent\": \"CAPTURE\",\n \"reference_id\": \"ord_12345\",\n \"description\": \"sezzle-store - #12749253509255\",\n \"items\": [\n {\n \"name\": \"widget\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"discounts\": [\n {\n \"name\": \"20% off\",\n \"amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ],\n \"metadata\": {\n \"location_id\": \"123\",\n \"store_name\": \"Downtown Minneapolis\",\n \"store_manager\": \"Jane Doe\"\n },\n \"shipping_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"tax_amount\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n },\n \"order_amount\": {\n \"amount_in_cents\": 10000,\n \"currency\": \"USD\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "fadbc642-05a4-4e38-9e74-80e325623af9",
"links": [
{
"href": "https://gateway.sezzle.com/v2/session/fadbc642-05a4-4e38-9e74-80e325623af9",
"method": "GET",
"rel": "self"
}
],
"order": {
"uuid": "12a34bc5-6de7-890f-g123-4hi1238jk902",
"checkout_url": "https://checkout.sezzle.com/?id=12a34bc5-6de7-890f-g123-4hi1238jk902",
"intent": "CAPTURE",
"links": [
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902",
"method": "GET",
"rel": "self"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902",
"method": "PATCH",
"rel": "self"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/release",
"method": "POST",
"rel": "release"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/capture",
"method": "POST",
"rel": "capture"
},
{
"href": "https://gateway.sezzle.com/v2/order/12a34bc5-6de7-890f-g123-4hi1238jk902/refund",
"method": "POST",
"rel": "refund"
}
]
}
}[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]