On this page
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.