Créer une session de carte
Creates a Sezzle virtual card session. A card session represents the issuance of a Sezzle virtual card to a Sezzle user and/or the agreement of a Sezzle user to use the virtual card as payment. Use the card session endpoints to create and update a card session.
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/session/card \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"origin": "https://example.com",
"mode": "iframe",
"merchant_reference_id": "merchant-cart-id-max-255",
"amount_in_cents": 1000,
"currency": "USD",
"card_response_format": "token",
"customer": {
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "6125551234",
"billing_address": {
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US"
}
},
"items": [
{
"name": "Blue tee",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
]
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/session/card"
payload = {
"origin": "https://example.com",
"mode": "iframe",
"merchant_reference_id": "merchant-cart-id-max-255",
"amount_in_cents": 1000,
"currency": "USD",
"card_response_format": "token",
"customer": {
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "6125551234",
"billing_address": {
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US"
}
},
"items": [
{
"name": "Blue tee",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"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({
origin: 'https://example.com',
mode: 'iframe',
merchant_reference_id: 'merchant-cart-id-max-255',
amount_in_cents: 1000,
currency: 'USD',
card_response_format: 'token',
customer: {
email: 'john.doe@example.com',
first_name: 'John',
last_name: 'Doe',
phone: '6125551234',
billing_address: {
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US'
}
},
items: [
{
name: 'Blue tee',
sku: 'sku123456',
quantity: 1,
price: {amount_in_cents: 1000, currency: 'USD'}
}
]
})
};
fetch('https://sandbox.gateway.sezzle.com/v2/session/card', 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/card",
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([
'origin' => 'https://example.com',
'mode' => 'iframe',
'merchant_reference_id' => 'merchant-cart-id-max-255',
'amount_in_cents' => 1000,
'currency' => 'USD',
'card_response_format' => 'token',
'customer' => [
'email' => 'john.doe@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '6125551234',
'billing_address' => [
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US'
]
],
'items' => [
[
'name' => 'Blue tee',
'sku' => 'sku123456',
'quantity' => 1,
'price' => [
'amount_in_cents' => 1000,
'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/card"
payload := strings.NewReader("{\n \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\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/card")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/session/card")
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 \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"uuid": "fadbc642-05a4-4e38-9e74-80e325623af9",
"dashboard_url": "https://dashboard.sezzle.com/example?id=0001"
}[
{
"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
The authentication token generated from providing API Keys to Sezzle Gateway
Corps
The amount in cents
The 3 character currency code as defined by ISO 4217
The window origin of the host
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 The checkout or cart ID from the merchant, currently used for tracking only (must contain only alphanumeric characters, dashes (-), and underscores (_))
Value of token required to use tokenization
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.
The customer for this session
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
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/session/card \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"origin": "https://example.com",
"mode": "iframe",
"merchant_reference_id": "merchant-cart-id-max-255",
"amount_in_cents": 1000,
"currency": "USD",
"card_response_format": "token",
"customer": {
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "6125551234",
"billing_address": {
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US"
}
},
"items": [
{
"name": "Blue tee",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"currency": "USD"
}
}
]
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/session/card"
payload = {
"origin": "https://example.com",
"mode": "iframe",
"merchant_reference_id": "merchant-cart-id-max-255",
"amount_in_cents": 1000,
"currency": "USD",
"card_response_format": "token",
"customer": {
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "6125551234",
"billing_address": {
"street": "123 W Lake St",
"street2": "Unit 104",
"city": "Minneapolis",
"state": "MN",
"postal_code": "55408",
"country_code": "US"
}
},
"items": [
{
"name": "Blue tee",
"sku": "sku123456",
"quantity": 1,
"price": {
"amount_in_cents": 1000,
"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({
origin: 'https://example.com',
mode: 'iframe',
merchant_reference_id: 'merchant-cart-id-max-255',
amount_in_cents: 1000,
currency: 'USD',
card_response_format: 'token',
customer: {
email: 'john.doe@example.com',
first_name: 'John',
last_name: 'Doe',
phone: '6125551234',
billing_address: {
street: '123 W Lake St',
street2: 'Unit 104',
city: 'Minneapolis',
state: 'MN',
postal_code: '55408',
country_code: 'US'
}
},
items: [
{
name: 'Blue tee',
sku: 'sku123456',
quantity: 1,
price: {amount_in_cents: 1000, currency: 'USD'}
}
]
})
};
fetch('https://sandbox.gateway.sezzle.com/v2/session/card', 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/card",
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([
'origin' => 'https://example.com',
'mode' => 'iframe',
'merchant_reference_id' => 'merchant-cart-id-max-255',
'amount_in_cents' => 1000,
'currency' => 'USD',
'card_response_format' => 'token',
'customer' => [
'email' => 'john.doe@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '6125551234',
'billing_address' => [
'street' => '123 W Lake St',
'street2' => 'Unit 104',
'city' => 'Minneapolis',
'state' => 'MN',
'postal_code' => '55408',
'country_code' => 'US'
]
],
'items' => [
[
'name' => 'Blue tee',
'sku' => 'sku123456',
'quantity' => 1,
'price' => [
'amount_in_cents' => 1000,
'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/card"
payload := strings.NewReader("{\n \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\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/card")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/session/card")
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 \"origin\": \"https://example.com\",\n \"mode\": \"iframe\",\n \"merchant_reference_id\": \"merchant-cart-id-max-255\",\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\",\n \"card_response_format\": \"token\",\n \"customer\": {\n \"email\": \"john.doe@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"6125551234\",\n \"billing_address\": {\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 }\n },\n \"items\": [\n {\n \"name\": \"Blue tee\",\n \"sku\": \"sku123456\",\n \"quantity\": 1,\n \"price\": {\n \"amount_in_cents\": 1000,\n \"currency\": \"USD\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"uuid": "fadbc642-05a4-4e38-9e74-80e325623af9",
"dashboard_url": "https://dashboard.sezzle.com/example?id=0001"
}[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]