Sezzle
Intégration Directe
Carte Virtuelle
Ressources
Paiement Express (Bêta)
Paiement Express (Bêta)
Quick guide
L’option Express Checkout n’est disponible que pour les marchands en intégration directe.
Installation
-
Importer la Bibliothèque
-
Copiez ce script dans le
<head>
de votre code de siteCopyAsk AI<script type="text/javascript" src="https://checkout-sdk.sezzle.com/express_checkout.min.js"></script>
-
-
Ajouter la Configuration
- Configurer Express Checkout
CopyAsk AIconst checkoutSdk = new ExpressCheckout({ mode: "popup", + publicKey: `${yourSezzleAPIKey}`, apiMode: "live", apiVersion: "v2", });
-
Configurer les écouteurs d’événements
CopyAsk AIcheckoutSdk.init({ onClick: function () { event.preventDefault(); checkoutSdk.startCheckout({ checkout_payload: { is_express_checkout: true, order: { + intent: "CAPTURE", + reference_id: yourReferenceID, + description: yourDescription, requires_shipping_info: true, items: [ { + name: yourProductName, + sku: yourProductSKU, + quantity: yourQuantity, price: { + amount_in_cents: yourProductPrice, + currency: "USD", }, }, ], discounts: [ { + name: yourDiscountName, amount: { + amount_in_cents: yourDiscount, + currency: "USD", }, }, ], shipping_amount: { + amount_in_cents: yourShippingAmount, + currency: "USD", }, tax_amount: { + amount_in_cents: yourTaxAmount, + currency: "USD", }, order_amount: { + amount_in_cents: yourOrderAmount, + currency: "USD", }, }, }, }); }, onComplete: function (response) { alert("Completed transaction. Capture started."); checkoutSdk .capturePayment(response.data.order_uuid, { capture_amount: { + amount_in_cents: yourCaptureAmount, + currency: "USD", }, partial_capture: false, }) .then((r) => { console.log(r); }); }, onCancel: function () { alert("Transaction cancelled."); }, onFailure: function () { alert("Transaction failed."); }, onCalculateAddressRelatedCosts: async function ( shippingAddress, order_uuid ) { // Call authentication endpoint const response = await fetch( + `$(yourBackendAuthenticationURL)`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ + public_key: yourSezzlePublicKey, + private_key: yourSezzlePrivateKey, }), } ); const data = await response.json(); const token = data.token; const updateResponse = await fetch( + `$(yourBackendUpdateOrderURL)`, { method: "PATCH", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ + amount_in_cents: yourAmount, + currency_code: "USD", + shipping_amount_in_cents: yourShippingAmount, + tax_amount_in_cents: yourTaxAmount, address_uuid: shippingAddress.uuid, }), } ); const updateStatus = updateResponse.ok; return { ok: updateStatus, }; }, });
-
Installer le Bouton
-
Copiez cet élément de placeholder à l’endroit où vous souhaitez que le bouton s’affiche sur la page
-
Voir ici pour les options de personnalisation
CopyAsk AI<div id="sezzle-smart-button-container" style="text-align: center"></div>
-
Charger le bouton en utilisant Javascript
CopyAsk AIawait checkoutSdk.renderSezzleButton("sezzle-smart-button-container");
-
Sur cette page
Assistant
Responses are generated using AI and may contain mistakes.