Skip to content

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.


The WeGetFinancing checkout flow has three phases:

  1. Your server calls the API to create a financing request and receives a href URL.
  2. The customer completes the financing application at that URL (shown in a lightbox or redirect).
  3. 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 order

POST https://api.wegetfinancing.com/merchant/{merchant_id}/requests

See Create Request for the full field reference and multi-language examples.

Minimal example:

Terminal window
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”

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.

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.

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.


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

{
"request_token": "abc123def456",
"merchant_transaction_id": "ORDER-123",
"status": "approved",
"approved_amount": "499.00",
"version": "1.9"
}
statusMeaning
approvedLender approved — create the order
preapprovedCustomer pre-qualified but hasn’t accepted an offer yet — no order yet
rejectedAll lenders declined — no order
cancelledCustomer 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.


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 table
INSERT 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';

Get sandbox credentials from the partner portal under Integration → API Integration:

EnvironmentAPI Base URL
Sandboxhttps://api.sandbox.wegetfinancing.com
Productionhttps://api.wegetfinancing.com

The sandbox is fully isolated from production — no real lenders, no real charges.

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.

Portal → Integration → Sent Postbacks — shows each delivery attempt with URL, HTTP status, timestamp, and full payload.


ItemDetail
Verify x-signatureAlways verify the postback signature using dhd_username / dhd_password. See Postbacks.
HTTPS on postback URLWeGetFinancing POSTs to whatever URL you configure — use TLS.
Idempotent order creationGuard against duplicate postbacks — check request_token before inserting.
Ignore onComplete for order creationThe browser callback can be manipulated.
Use merchant_transaction_idTie 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 quicklyAvoid slow synchronous processing in your postback handler.

  • approved postback received → order created
  • Customer closes lightbox without completing → onAbort fires → no order created, no postback
  • preapproved postback → no order created
  • rejected postback → customer informed gracefully, no order
  • Duplicate postback ignored (no duplicate order)
  • x-signature verified correctly on every postback
  • Postback handler returns HTTP 200 within 5 seconds
  • Tested on mobile (both lightbox and redirect flows)