Skip to content
0 reviews deleted for paymentHow TrustSays works
Help

Report orders with the API and send invitations

Your system reports orders to POST /v1/orders with a signed API key, and delivered orders trigger invitations.

Pricing, payment and API1 min read
On this page
  1. Endpoint
  2. Signature
  3. The response
  4. If it doesn't work

If you don't use Shopify or WooCommerce, your own system can report orders to TrustSays. When an order has been delivered, the customer is invited automatically. Automatic invitations require Start or higher. Orders are stored on all plans.

Endpoint

POST https://api.trustsays.com/v1/orders with JSON in the body:

  • orderRef: your order number.
  • email: the customer's email.
  • name: the customer's name, optional.
  • status: paid, delivered, cancelled or refunded.
  • paidAt and deliveredAt: timestamps, optional.
  • locale: the customer's language and country, e.g. en-GB. It controls the language of the invitation.

Signature

Each call is sent with three headers:

  • X-TrustSays-Key: the prefix from the key, i.e. the text between ts_ and the next underscore.
  • X-TrustSays-Timestamp: the time in Unix seconds.
  • X-TrustSays-Signature: sha256= followed by the HMAC-SHA256 in hex of the timestamp, a full stop and the exact body, using the secret from the key.

Calls more than 5 minutes old are rejected.

The response

order is created or updated. The same order number again updates the order. invitation tells you what happened:

  • scheduled: the invitation has been scheduled.
  • not_delivered: the order hasn't been delivered yet.
  • not_in_plan: your plan doesn't include automatic invitations.
  • quota: the month's invitations have been used up.
  • cancelled: cancelled or refunded, so no invitation is sent.
  • duplicate, unsubscribed or invalid_email: the customer has already been invited, has opted out of emails, or the email is invalid.

If it doesn't work

  • Invalid signature: Sign the exact body you send, and check the key.
  • The timestamp is too old: Check the server's clock.

All customers must be invited in the same way. Report all orders, not just those from happy customers.

Was this helpful?
Still need help?Write to us and we'll get back to you. We reply on weekdays between 8 and 18.Contact us

We use cookies

Necessary cookies make the site work. If you accept all, we also use cookies for statistics and to measure our own ads. Read the cookie policy