E-CommerceSustainabilityAPIDonations

Ecwid Tree Planting and Donations Guide

GoodAPI Team ·

Ecwid by Lightspeed sits in an unusual spot. It is a cart you drop into a site you already own, whether that site runs on WordPress, Webflow, Wix, or a hand-built HTML page, and that portability is why merchants pick it. It also means the usual advice about installing a sustainability app from a marketplace does not map cleanly. Ecwid tree planting is very much possible, and so are verified charity donations, but the route runs through order webhooks and the REST API. Here is how that build works, where Ecwid’s own donation feature stops short, and what the program costs.

Why Ecwid Tree Planting Beats a Sustainability Badge

A leaf icon in the footer used to be enough. It is not anymore. Shoppers read vague environmental language as a signal that nothing measurable sits behind it, and regulators now treat unsubstantiated green claims as a compliance problem. Brands that still get credit can name the action, the volume, and the verifier.

Per-order impact gives you all three. “We plant one verified tree for every order, GPS-tracked through Veritree” has a unit, a trigger, and a third party attached, and an Ecwid store can make that claim as credibly as a Shopify store. Only the plumbing differs, and on Ecwid that plumbing is a webhook.

Ecwid Tips Are Not Charity Donations

Ecwid’s own help center describes collecting donations through the Tips and gratuity setting, and plenty of merchants stop reading there. Under Settings, then General, then Cart & Checkout, you can enable a tipping section, choose fixed amounts or a percentage of the order total, allow a custom amount, and retitle the section “Donations” instead of “Tip”. The money then arrives in your payout like any other line on the order. It is your revenue. Nothing routes to a nonprofit, no receipt is issued, and the customer has no tax-deductible gift. Ecwid documents a second limit: the shopper needs at least one product in the cart, because an empty cart cannot check out. Some stores work around it with a Pay What You Want product priced from zero, at the cost of a phantom SKU.

Tipping is a fine way to let customers add a few dollars in support. It is simply a different product from verified charitable giving, and calling it a donation is the kind of claim that gets brands in trouble.

What you get Ecwid Tips and gratuity GoodAPI on Ecwid GoodAPI Shopify app
Where the money goes To you, the merchant Verified nonprofits or planting projects Verified nonprofits or planting projects
Setup A toggle in store settings Order webhook plus a small function One-click from the App Store
Code required None A small server or edge function None
Nonprofit network None 1.3M verified 501(c)(3)s 1.3M verified 501(c)(3)s
Empty cart allowed No, one product minimum Not applicable, triggers on orders Not applicable, triggers on orders
CCV compliance handled Not applicable Yes, all 50 US states Yes, all 50 US states

Is There a Native Ecwid Sustainability App?

Not from GoodAPI, and it is better to say so plainly than to let you find out after signing up. There is no GoodAPI listing in the Ecwid App Market. The packaged install lives on Shopify, and the integrations page covers Squarespace, BigCommerce, Duda, and a custom API path alongside it.

For contrast, Shopify merchants install the GoodAPI app from the Shopify App Store, which sits at 5.0 stars across 221 reviews , and configure per-order rules, product rules, and round-ups from the admin without writing anything. If you run an Ecwid storefront alongside a Shopify checkout, use the app on the Shopify side and keep the webhook work for Ecwid. What Ecwid gives you in exchange is control over the trigger and the volume: one tree per order, trees scaled to order value, plastic removal on a single collection, or a donation routed to a nonprofit that fits your brand.

Step by Step: Ecwid Tree Planting Through Order Webhooks

Here is the build in full.

1

Create a custom app for your store

Ecwid webhooks belong to apps, not stores, so ask Ecwid for a custom app registered to your store ID. You get a client ID, a client secret, and an access token. Request the read_orders scope.

2

Get GoodAPI test and production keys

Sign up at app.thegoodapi.com. Test keys behave like production keys but never charge you and never plant real trees, so build against a test key first.

3

Deploy a small endpoint

A Cloudflare Worker, a Vercel or Netlify function, or a route on a server you already run. It accepts a POST, verifies it, and makes one outbound call. Keep GOODAPI_KEY, your client secret, and your access token in environment secrets, never in the storefront.

4

Subscribe to order.created

Register your endpoint as the app’s webhook URL and request the order.created event. Add order.updated if you would rather react to payment changes, refunds, or cancellations.

5

Verify the signature, then re-fetch the order

Ecwid signs each delivery with the X-Ecwid-Webhook-Signature header, and that signature covers only the eventCreated and eventId fields rather than the whole body. Verify it, reject deliveries without it, then call GET https://app.ecwid.com/api/v3/{storeId}/orders/{orderId} for the values you trust, such as the total and payment status.

6

Plant with an idempotency key

Call POST https://app.thegoodapi.com/plant/trees with the Ecwid order ID as your idempotency_key. Retries then resolve to one planting instead of duplicates on your invoice.

The Middleware

The webhook body is small on purpose: eventId, eventCreated, storeId, entityId, eventType, and a data object. One gotcha matters. For order events, entityId is Ecwid’s internal numeric ID and the order endpoints reject it. Use data.orderId for the API call and the idempotency key.

export default {
async fetch(request, env) {
const body = await request.text();
const signature = request.headers.get('x-ecwid-webhook-signature');
const event = JSON.parse(body);
if (!(await isValidSignature(event, signature, env.ECWID_CLIENT_SECRET))) {
return new Response('Invalid signature', { status: 401 });
}
if (event.eventType !== 'order.created') {
return new Response('Ignored', { status: 200 });
}
const orderId = event.data.orderId;
await fetch('https://app.thegoodapi.com/plant/trees', {
method: 'POST',
headers: {
Authorization: `Bearer ${env.GOODAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
count: 1,
idempotency_key: orderId,
metadata: { order_id: orderId, store_id: event.storeId, source: 'ecwid' },
}),
});
return new Response('OK', { status: 200 });
},
};

The signature check is an HMAC-SHA256 over the two event fields joined by a dot, base64 encoded, using your app’s client secret as the key.

async function isValidSignature(event, signature, secret) {
if (!signature) return false;
const encoder = new TextEncoder();
const key = await crypto.subtle.importKey(
'raw',
encoder.encode(secret),
{ name: 'HMAC', hash: 'SHA-256' },
false,
['sign'],
);
const mac = await crypto.subtle.sign(
'HMAC',
key,
encoder.encode(`${event.eventCreated}.${event.eventId}`),
);
const expected = btoa(String.fromCharCode(...new Uint8Array(mac)));
return expected === signature;
}

No-Code Paths: Zapier and Monthly Volume

Not every Ecwid merchant has a developer on call, and two lighter routes still produce real trees.

The first is a connector. Zapier already publishes Ecwid triggers alongside tree planting actions from other providers, so the pattern is well worn: a new paid order fires a zap, the zap calls an HTTP action against the planting endpoint, and nothing gets deployed. You lose precision, because connector runs are less reliable than a direct webhook.

The second is simpler still. Read your order count in the Ecwid admin at month end and set a matching monthly planting volume in the GoodAPI dashboard. The tradeoff is that you cannot tell a customer their order planted a specific tree, so keep on-site language at the program level.

Adding Ecwid Donations With a Verified Nonprofit Network

Trees are the easy story to tell, but plenty of brands have a cause that fits them better than reforestation. GoodAPI donations reach more than 1.3 million verified 501(c)(3) nonprofits, cover commercial co-venture compliance in all 50 US states, and GoodAPI takes a 0% platform fee on the donated amount. Compliance is the underestimated part, because telling customers a share of their purchase goes to charity is a regulated claim in many states.

The build is the same shape as the planting flow. Your handler already fetched the order, so it can compute a flat per-order contribution, a percentage of order value, or a round-up you collected as a line item. Charity search resolves a nonprofit by name or EIN, so customers can pick a cause instead of taking yours. Donations sit on the Give plan, and API access plus checkout round-ups sit on the Lead plan.

Running tips and real donations together is fine if the wording is right: label the tip section as support for your business, and describe the charitable half as a contribution your store funds from its own margin.

Buy Buttons, Embeds, and Where the Trigger Lives

Ecwid’s appeal is that the store does not have to live at an Ecwid URL. A Buy Button on a landing page, a catalog embedded in a WordPress theme, and a standalone Instant Site all run the same commerce engine underneath. As long as checkout is handled by Ecwid, every one of those surfaces produces a normal order and order.created fires the same way. You do not need a setup per embed, and you never touch the host site. The trigger follows the order, not the page.

The exception is a store that uses Ecwid only for browsing and hands checkout to something else. No Ecwid order exists, so no event arrives. Hook the provider that processed the payment instead, and the GoodAPI call stays identical.

Pricing Without the Fine Print

The Grow plan is free to install and includes your first 50 trees and 100 plastic bottles at no charge. After that trees are $0.43 each and ocean-bound plastic is $0.05 per bottle , billed on one end-of-month invoice with no monthly fee for trees and plastic. An Ecwid store running 400 orders a month at one tree per order lands around $172 in planting.

Two things sit outside that. Donations run on the Give plan at $15 per month, and checkout round-ups plus API access run on the Lead plan at $49 per month. The “no monthly fee” line applies to trees and plastic on Grow, not the entire catalog, which is worth knowing before you scope the build.

Common Pitfalls

Using entityId as the order ID. For order events that value is Ecwid’s internal ID and the order endpoints reject it. Use data.orderId.

No idempotency key. Ecwid retries deliveries, and webhooks fire from any source including your own REST writes. Without idempotency_key set to the order ID, every retry plants again.

Planting before payment settles. Gate on payment status, or move the trigger to order.updated, if unpaid or cancelled orders happen.

Best for

Ecwid merchants who want verified per-order trees, plastic removal, or real charity donations via webhook, connector, or monthly volume

Getting Started

Ecwid tree planting is one app registration, one webhook, one small function, and one API call. No-code paths exist if that is more than you want.

Same pattern elsewhere: WooCommerce, BigCommerce, Webflow, and Squarespace.

Grab a test key, subscribe to order.created, and put a verified tree behind your next Ecwid order.