Easymailing
Orders

Mark an order as paid

PUT /stores/{storeResourceId}/orders/{resourceId}/actions/pay_order

PUT/stores/{storeResourceId}/orders/{resourceId}/actions/pay_order

Sets the order to paid and records the revenue: it is added to the member who bought and, if a campaign code is known, to that campaign. It stops abandoned-cart and payment-reminder automations for this order. Call it once, for a cart or a new order.

When to use: When the payment is confirmed. It is the step that counts revenue.

When not to use: For orders loaded from the past, without revenue tracking, use import_order.

Side effects: Starts the automations with an order paid trigger (create_trigger_order_paid), cancels the abandoned-cart and payment-reminder automations waiting on this order, adds the revenue to the member and updates the campaign and audience statistics. Adds an entry to the activity of the member. The API does not check the current status of the order: calling it on an order in another status is accepted and fires the order paid automations and the activity entry again.

Permissions: Requires the manager role or higher, or the marketing.audiences.write capability.

Authorization

X-Auth-Token<token>

Value for the X-Auth-Token header parameter.

In: header

Path Parameters

storeResourceId*string

Identifier (resource_id) of the store the order belongs to.

resourceId*string

Identifier (resource_id) of the order: the one you chose when you created it.

Request Body

The updated OrderResource resource

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X PUT "https://api.easymailing.com/stores/acme-shop/orders/order-5001/actions/pay_order" \  -H "X-Auth-Token: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "paid_at": "2019-08-24T14:15:22Z",    "campaign_hash": "string"  }'
{  "resource_id": "string",  "currency": "string",  "currency_exchange_rate": 0.1,  "order_total": 0,  "tax_total": 0,  "discount_total": 0,  "shipping_total": 0,  "checkout_url": "http://example.com",  "status": "cart",  "order_number": "string",  "tracking_number": "string",  "tracking_carrier": "string",  "tracking_url": "http://example.com",  "abandoned_cart_at": "2019-08-24T14:15:22Z",  "processed_at": "2019-08-24T14:15:22Z",  "paid_at": "2019-08-24T14:15:22Z",  "cancelled_at": "2019-08-24T14:15:22Z",  "campaign_hash": "string",  "order_items": [    {      "quantity": 1,      "price": 0,      "discount": 0,      "variant": "/entity/1"    }  ],  "customer": "/entity/1",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}