Skip to content

How do I send orders from my checkout?

Updated · Integrations

Send each order from your server when it is placed, and again when its status changes. A review request follows when the order reaches the status your store asks for.

Send an order

With @pepreviewpro/server, call prp.orders.upsert(order, { request }) in the route that places the order. Pass the checkout request, and the SDK reads the buyer's attribution and reviews-seen cookies, IP address, and user agent from it. Your order id can be a string, like NP-10432.

An order needs only its id and status. Send the buyer's email and the line items too, or no review request can go out.

Sending an order again is safe. It updates the order, and a repeat that changes nothing comes back unchanged. Each call carries an Idempotency-Key, so its retries never act twice.

Which status sends a review request

On the Next.js or React tab of the Integrations page, the Review requests card holds Request reviews when an order is:

  • Completed, the default. A request is queued when the order is completed.
  • Paid. A request is queued when the order is paid, and also when it is completed. Pick it if your checkout never marks orders as fulfilled.

Select Save after you change it. The setting applies to orders sent with the SDK. Orders from the WordPress plugin always wait for completed.

An order sent as refunded or cancelled stops any request for it that hasn't gone out yet. A pending order is saved with no request. A request also needs a campaign that is on. When do review requests go out?

Send recent orders again each day

Checkout calls miss orders when either side is down or a deploy breaks the call. A job that sends the last 48 hours again once a day catches them. Orders we already have come back unchanged. A missed one is created, and its request goes out late instead of never.

From your own code, call prp.orders.import(orders, { sendEmail: true }) with the orders that changed in that window. Or pipe an export of them into the command line:

my-store-export --since 48h --format json | npx pepreviewpro sync-orders --since 48h

sync-orders leaves out orders with no date, so a full export never mails old buyers.

The daily job is recommended, not required. The Connection card also warns when orders stop for 3 days on a store that usually gets them daily.

Without the SDK

The SDK calls POST /api/v1/orders. Any code on your server can call it with a store key. The full reference is in Docs under API.

Was this helpful?

Still need help?

Send us a message and a person on our team will reply by email.

Contact us