Custom Integration Guide
Use this guide when your platform has no pre-built WeGetFinancing plugin, or when you need full control over the checkout experience. The same v1 API underpins all platform plugins — this guide documents it directly.
How It Works
Section titled “How It Works”The WeGetFinancing checkout flow has three phases:
- Your server calls the API to create a financing request and receives a
hrefURL. - The customer completes the financing application at that URL (shown in a lightbox or redirect).
- WeGetFinancing posts a server-side postback to your configured URL when a lender decision is made.
Cart → POST /merchant/{id}/requests → { href, request_token } ↓ Customer opens href (lightbox / redirect) ↓ WeGetFinancing POSTs approved/rejected to your server ↓ Create or cancel orderStep 1 — Create a Financing Request
Section titled “Step 1 — Create a Financing Request”POST https://api.wegetfinancing.com/merchant/{merchant_id}/requests
See Create Request for the full field reference and multi-language examples.
Minimal example:
curl -X POST \ -u "username:password" \ -H "Content-Type: application/json" \ "https://api.sandbox.wegetfinancing.com/merchant/YOUR_MERCHANT_ID/requests" \ -d '{ "merchant_transaction_id": "ORDER-123", "first_name": "Jane", "last_name": "Doe", "email": "jane@example.com", "phone": "2125551234", "billing_address1": "123 Main St", "billing_city": "New York", "billing_state": "NY", "billing_zipcode": "10001", "shipping_address1": "123 Main St", "shipping_city": "New York", "shipping_state": "NY", "shipping_zipcode": "10001", "amount": "499.00", "version": "1.9", "cart_items": [ { "sku": "WID-001", "display_name": "Super Widget", "unit_price": "499.00", "quantity": "1", "unit_tax": "0.00" } ] }'Successful response:
{ "href": "https://app.wegetfinancing.com/checkout?token=abc123", "request_token": "abc123def456"}Use merchant_transaction_id to correlate the returned postback with your order. Use version: "1.9" to receive JSON-formatted postbacks.
Step 2 — Present the Flow to the Customer
Section titled “Step 2 — Present the Flow to the Customer”Option A — Lightbox Widget
Section titled “Option A — Lightbox Widget”The lightbox opens the financing flow in an overlay on top of your checkout page — no redirect required.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script src="https://cdn.wegetfinancing.com/libs/1.0/wegetfinancing.js"></script><script> // After receiving href from your server: var onComplete = function() { // Fires when the customer completes the flow in the browser. // NOTE: do NOT create the order here — wait for the server-side postback. }; var onAbort = function() { // Customer closed the lightbox without completing. }; new WeGetFinancing("HREF_FROM_API", onComplete, onAbort);</script>See Lightbox Widget for the full API.
Option B — Direct Redirect
Section titled “Option B — Direct Redirect”Simply redirect the customer to the href returned by the API. After completion, WeGetFinancing redirects back to the URL you configured in the partner portal under Integration → Postback Settings → Return URL.
Option C — Link Integration
Section titled “Option C — Link Integration”Pre-generate a financing URL without collecting customer details upfront. The customer fills in their information on the WeGetFinancing side.
See Link Integration for setup.
Step 3 — Handle the Postback
Section titled “Step 3 — Handle the Postback”WeGetFinancing POSTs a JSON payload to your configured postback URL when a lender makes a decision. This is the authoritative signal — always create or cancel orders based on the postback, not browser callbacks.
Postback URL configured at: Partner Portal → Integration → Postback Settings
Postback Payload (v1.9 JSON)
Section titled “Postback Payload (v1.9 JSON)”{ "request_token": "abc123def456", "merchant_transaction_id": "ORDER-123", "status": "approved", "approved_amount": "499.00", "version": "1.9"}status | Meaning |
|---|---|
approved | Lender approved — create the order |
preapproved | Customer pre-qualified but hasn’t accepted an offer yet — no order yet |
rejected | All lenders declined — no order |
cancelled | Customer or lender cancelled — no order |
Verify the postback signature before acting on it. See Postbacks to Merchants for the x-signature verification algorithm.
Respond with HTTP 2xx immediately. Do not perform slow operations synchronously — WeGetFinancing will retry on non-2xx responses.
Order Management Pattern
Section titled “Order Management Pattern”Never create an order on the browser onComplete callback — it can be spoofed. Use the server-side postback as the single source of truth.
-- 1. Before calling the API, save the cart in a pending tableINSERT INTO wgf_pending_carts (merchant_transaction_id, cart_data, created_at)VALUES ('ORDER-123', '...', NOW());
-- 2. On approved postback, promote pending cart → order (idempotent check first)INSERT INTO orders SELECT * FROM wgf_pending_carts WHERE merchant_transaction_id = 'ORDER-123' AND NOT EXISTS (SELECT 1 FROM orders WHERE wgf_token = 'abc123def456');
DELETE FROM wgf_pending_carts WHERE merchant_transaction_id = 'ORDER-123';Sandbox Testing
Section titled “Sandbox Testing”Credentials
Section titled “Credentials”Get sandbox credentials from the partner portal under Integration → API Integration:
| Environment | API Base URL |
|---|---|
| Sandbox | https://api.sandbox.wegetfinancing.com |
| Production | https://api.wegetfinancing.com |
The sandbox is fully isolated from production — no real lenders, no real charges.
Forcing Postback Decisions
Section titled “Forcing Postback Decisions”Postbacks only fire when a lender reaches a decision. To trigger one quickly:
- Submit an amount outside your configured lending range (e.g.,
$1) — lender rejects immediately. - Complete a test application using the mock credentials in the portal under Integration Instructions.
Verifying Delivery
Section titled “Verifying Delivery”Portal → Integration → Sent Postbacks — shows each delivery attempt with URL, HTTP status, timestamp, and full payload.
Security Checklist
Section titled “Security Checklist”| Item | Detail |
|---|---|
Verify x-signature | Always verify the postback signature using dhd_username / dhd_password. See Postbacks. |
| HTTPS on postback URL | WeGetFinancing POSTs to whatever URL you configure — use TLS. |
| Idempotent order creation | Guard against duplicate postbacks — check request_token before inserting. |
Ignore onComplete for order creation | The browser callback can be manipulated. |
Use merchant_transaction_id | Tie each request to your own order ID for easy postback correlation. |
Use version: "1.9" | Ensures JSON postback format — easier to parse and sign than the legacy URL-encoded format. |
| Respond 2xx quickly | Avoid slow synchronous processing in your postback handler. |
Pre-Launch Checklist
Section titled “Pre-Launch Checklist”-
approvedpostback received → order created - Customer closes lightbox without completing →
onAbortfires → no order created, no postback -
preapprovedpostback → no order created -
rejectedpostback → customer informed gracefully, no order - Duplicate postback ignored (no duplicate order)
-
x-signatureverified correctly on every postback - Postback handler returns HTTP 200 within 5 seconds
- Tested on mobile (both lightbox and redirect flows)