Skip to main content

WordPress and WooCommerce

Push paid WooCommerce orders into Sharity as completed donations.

A
Written by Antonio Ryckman

When a donor already pays in WooCommerce, your plugin should tell Sharity so the gift appears as a completed donation and the buyer as a supporter — tagged with source woocommerce and the WooCommerce order id.

Use the campaign URL slug from Campaign → Settings. Embed Sharity widgets only when you want checkout to run inside Sharity/Stripe instead.

Prerequisites

  • A paid Sharity plan

  • API key with write scope

  • Campaign URL slug

  • WordPress code that can POST to HTTPS after the order is paid

Steps

  1. Create a write API key and store it in plugin settings or server env — never in the WordPress repo.

  2. Copy the campaign URL slug from Campaign → Settings. Send it as campaignSlug (campaign id also works).

  3. On order paid (for example woocommerce_order_status_completed), POST to https://<your-dashboard-host>/api/v1/orders with header Authorization: Bearer <key> and JSON including campaignSlug, source (woocommerce), externalOrderId, amountCents, and email (optional firstName, lastName, metadata). Sharity creates a completed donation (no Stripe charge), upserts the supporter, applies campaign → list rules, and may fire outbound donation.completed. Replays with the same campaign + source + order id return as idempotent.

  4. Confirm in Donations (WooCommerce badge) and Supporters. Optionally also register webhooks if WordPress should receive Sharity events.

Did this answer your question?