Shipping Update
After a loan is approved and the order ships, merchants push shipping information back to WeGetFinancing.
Endpoint
Section titled “Endpoint”POST /merchant/{merchant_id}/shippingAuthentication
Section titled “Authentication”HTTP Basic Auth with merchant credentials. See Public API Overview.
Request
Section titled “Request”Content-Type: application/json| Field | Type | Required | Description |
|---|---|---|---|
loan_id | string | Yes | The inv_id returned by the create-request call |
shipping_event | object | Yes | Shipping event data (see below) |
ShippingEvent Fields
Section titled “ShippingEvent Fields”| Field | Type | Required | Description |
|---|---|---|---|
date | string | Yes | Shipment date |
state | enum | Yes | accepted, partial, dispatched, delivered, recalled, other |
items | string[] | No | List of shipped item identifiers |
message | string | No | Status message |
expected_delivery_date | string | No | Expected delivery date |
service_type | string | No | Carrier service type |
shipment_company | string | No | Carrier name (e.g. UPS, FedEx) |
tracking_number | string | No | Carrier tracking number |
ShipmentState values:
| Value | Description |
|---|---|
accepted | Stock confirmed, ready to ship |
partial | Some items confirmed and shipped |
dispatched | All items shipped or ready for pickup |
delivered | Shipment delivered to customer |
recalled | Shipment cancelled or recalled |
other | Other / unexpected status |
curl -u "$USERNAME:$PASSWORD" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST \ "https://api.sandbox.wegetfinancing.com/merchant/1234/shipping" \ -d '{ "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": { "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18" } }'import httpx # or: import requests as httpx
payload = { "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": { "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18", },}response = httpx.post( "https://api.sandbox.wegetfinancing.com/merchant/1234/shipping", json=payload, auth=(username, password),)result = response.json()# result["type"] == "done" — the shipping event was recordedhttp -a "$USERNAME:$PASSWORD" POST \ https://api.sandbox.wegetfinancing.com/merchant/1234/shipping \ loan_id=df0c3186b69be8aad35ff837a841d347 \ shipping_event:='{"date":"2024-01-15","state":"dispatched","shipment_company":"UPS","tracking_number":"1Z999AA10123456784","expected_delivery_date":"2024-01-18"}'// fetch is built in to Node 18+, Bun, Deno, and browsers.// In the browser, swap Buffer.from(...).toString('base64') for btoa(`${username}:${password}`).const res = await fetch('https://api.sandbox.wegetfinancing.com/merchant/1234/shipping', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'), }, body: JSON.stringify({ loan_id: 'df0c3186b69be8aad35ff837a841d347', shipping_event: { date: '2024-01-15', state: 'dispatched', shipment_company: 'UPS', tracking_number: '1Z999AA10123456784', expected_delivery_date: '2024-01-18', }, }),});const result = await res.json();// result.type === 'done' — the shipping event was recordedinterface ShippingResponse { loan: string; // the loan document ID the event was recorded against type: string; // always 'done' http_code: number; // always 200}
const res = await fetch('https://api.sandbox.wegetfinancing.com/merchant/1234/shipping', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'), }, body: JSON.stringify({ loan_id: 'df0c3186b69be8aad35ff837a841d347', shipping_event: { date: '2024-01-15', state: 'dispatched', shipment_company: 'UPS', tracking_number: '1Z999AA10123456784', expected_delivery_date: '2024-01-18', }, }),});const result = (await res.json()) as ShippingResponse;require 'vendor/autoload.php';use GuzzleHttp\Client;
$client = new Client;$res = $client->post('https://api.sandbox.wegetfinancing.com/merchant/1234/shipping', [ 'auth' => [$username, $password], 'json' => [ 'loan_id' => 'df0c3186b69be8aad35ff837a841d347', 'shipping_event' => [ 'date' => '2024-01-15', 'state' => 'dispatched', 'shipment_company' => 'UPS', 'tracking_number' => '1Z999AA10123456784', 'expected_delivery_date' => '2024-01-18', ], ],]);$result = json_decode($res->getBody(), true);// $result['type'] === 'done' — the shipping event was recordedrequire "net/http"require "json"require "uri"
uri = URI("https://api.sandbox.wegetfinancing.com/merchant/1234/shipping")payload = { loan_id: "df0c3186b69be8aad35ff837a841d347", shipping_event: { date: "2024-01-15", state: "dispatched", shipment_company: "UPS", tracking_number: "1Z999AA10123456784", expected_delivery_date: "2024-01-18" }}
req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")req.basic_auth(username, password)req.body = payload.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }result = JSON.parse(res.body)# result["type"] == "done" — the shipping event was recordedimport ( "bytes" "encoding/json" "net/http")
payload := map[string]any{ "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": map[string]string{ "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18", },}body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.sandbox.wegetfinancing.com/merchant/1234/shipping", bytes.NewReader(body))req.Header.Set("Content-Type", "application/json")req.SetBasicAuth(username, password)
resp, _ := http.DefaultClient.Do(req)defer resp.Body.Close()
var result map[string]anyjson.NewDecoder(resp.Body).Decode(&result)// result["type"] == "done" — the shipping event was recordeduse serde_json::{json, Value};
let payload = json!({ "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": { "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18" }});
let result: Value = reqwest::Client::new() .post("https://api.sandbox.wegetfinancing.com/merchant/1234/shipping") .basic_auth(username, Some(password)) .json(&payload) .send() .await? .json() .await?;// result["type"] == "done" — the shipping event was recordedimport java.net.URI;import java.net.http.*;import java.util.Base64;
String body = """ { "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": { "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18" } }""";
String auth = Base64.getEncoder().encodeToString((username + ":" + password).getBytes());HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.sandbox.wegetfinancing.com/merchant/1234/shipping")) .header("Content-Type", "application/json") .header("Authorization", "Basic " + auth) .POST(HttpRequest.BodyPublishers.ofString(body)) .build();
HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString());// parse response.body() as JSON; `type` is "done" on successimport java.net.URIimport java.net.http.HttpClientimport java.net.http.HttpRequestimport java.net.http.HttpResponseimport java.util.Base64
val body = """ { "loan_id": "df0c3186b69be8aad35ff837a841d347", "shipping_event": { "date": "2024-01-15", "state": "dispatched", "shipment_company": "UPS", "tracking_number": "1Z999AA10123456784", "expected_delivery_date": "2024-01-18" } }""".trimIndent()
val auth = Base64.getEncoder().encodeToString("$username:$password".toByteArray())val request = HttpRequest.newBuilder() .uri(URI.create("https://api.sandbox.wegetfinancing.com/merchant/1234/shipping")) .header("Content-Type", "application/json") .header("Authorization", "Basic $auth") .POST(HttpRequest.BodyPublishers.ofString(body)) .build()
val response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString())// parse response.body() as JSON; `type` is "done" on successusing System.Net.Http.Headers;using System.Net.Http.Json;using System.Text;
using var client = new HttpClient();client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( "Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}")));
var payload = new{ loan_id = "df0c3186b69be8aad35ff837a841d347", shipping_event = new { date = "2024-01-15", state = "dispatched", shipment_company = "UPS", tracking_number = "1Z999AA10123456784", expected_delivery_date = "2024-01-18", },};
var response = await client.PostAsJsonAsync( "https://api.sandbox.wegetfinancing.com/merchant/1234/shipping", payload);var result = await response.Content.ReadFromJsonAsync<Dictionary<string, object>>();// result["type"] == "done" — the shipping event was recordedResponses
Section titled “Responses”{ "loan": "df0c3186b69be8aad35ff837a841d347", "type": "done", "http_code": 200}{ "type": "error", "error": "missing_parameters", "code": 400, "message": "MissingParameters", "subjects": ["field_name"], "reasons": { "field_name": "Missing required parameter" }}{ "type": "error", "error": "http", "code": 401, "message": "Unauthorized" }{ "type": "error", "error": "invalid_parameters", "code": 422, "message": "Loan not owned by merchant" }Success Response Fields
Section titled “Success Response Fields”| Field | Type | Description |
|---|---|---|
loan | string | The loan document ID the event was recorded against |
type | string | Always "done" |
http_code | integer | Always 200 |