Refund an order that was paid online
https://api.app2email.com/v1/{number}/shop/orders/{id}/refund Scope: orders:manage. Not with a sandbox key. In full when amount is left out, else that many minor units (at most refundable). The money goes back through the payment provider the way it was paid; an order paid at the counter cannot be refunded here. The order itself stays as it is: cancel it with POST /shop/orders/{id}/action when it should also end.
Path
-
Your app2email WhatsApp number - the number the message is sent FROM. Full number with country code, digits only.
e.g.4976659348270 -
The order's id, or its reference (SO-K7M2QX).
e.g.SO-K7M2QX
Body application/json
-
Minor units. Left out: all that is left.
Responses
Fields
- e.g.
true -
An order as the staff see it. Money in minor units.
52 fields
- id integer
- reference stringe.g.
SO-K7M2QX - status string
pending_payment = waits for its online payment; unconfirmed = a visitor of the order page has not confirmed on WhatsApp yet; new = waits for the shop to accept it.
pending_paymentunconfirmednewacceptedpreparingreadyout_for_deliverycompletedcancelledrejectedexpired - status_text string
- source string
webchatflowcounterapi - fulfilment string
pickupdelivery - asap boolean
- due_at string (date-time) | null
- due_label string
- slot_label string
- customer_name string
- customer_phone string
- customer_email string
- contact_identity string
The customer's WhatsApp number (digits) or business-scoped user id.
- contact_verified boolean
-
The delivery address; {} for a pickup.
- delivery_method string
- delivery_zone string
- note string
- allergy_note string
- items_count integer
- items_text stringe.g.
2 x Margherita, 1 x Cola - currency string
- subtotal integer
Whole minor units (cents): 1250 = 12.50.
- discount integer
Whole minor units (cents): 1250 = 12.50.
- discount_code string
- delivery_fee integer
Whole minor units (cents): 1250 = 12.50.
- fees integer
Whole minor units (cents): 1250 = 12.50.
- tip integer
Whole minor units (cents): 1250 = 12.50.
- tax integer
Whole minor units (cents): 1250 = 12.50.
- total integer
Whole minor units (cents): 1250 = 12.50.
- total_label stringe.g.
$30.50 - refunded integer
Whole minor units (cents): 1250 = 12.50.
- refundable integer
Whole minor units (cents): 1250 = 12.50.
- payment_state string
not_neededon_pickupon_deliverypendingauthorisedpaidpart_refundedrefundedreleasedfailed - payment_method string
- payment_id integer | null
- pickup_code string
The 4 characters the customer can say at the counter.
- order_url string
The customer's page of this order.
- actions string[]
What POST /shop/orders/{id}/action accepts for this order now.
- can_refund boolean
- late boolean
- created_at string (date-time)
- accepted_at string (date-time) | null
- ready_at string (date-time) | null
- completed_at string (date-time) | null
- cancelled_at string (date-time) | null
- cancelled_by string
- cancel_reason string
- handed_by string
- handed_method string
- lines object[]
Left out in lists.
13 item fields
- id integer
- item_id integer
- variant_id integer | null
- sku string
- name string
- variant_label string
- options object[]
- qty integer
- unit_price integer
Whole minor units (cents): 1250 = 12.50.
- unit_price_label string
- line_total integer
Whole minor units (cents): 1250 = 12.50.
- line_total_label string
- note string
- events object[]
GET only: the history, newest last: what happened, who did it, on which device.
- notice string
After an action: something to read, eg a refund that did not go through.
- repeated boolean
POST /shop/orders: true = this key was used before and this is that order.
- checkout_url string
POST /shop/orders with pay online: where the customer pays.
- payment_id integer | null
Errors
- 400 The request is malformed (missing or invalid fields, query parameters or times).
- 401 Missing, invalid, revoked or expired API key.
- 403 The key is valid but this call is not allowed: the key lacks the scope the call needs (insufficient_scope), the address is not allowed for the key (ip_not_allowed), the number or plan does not allow it, a recipient opted out or is not opted in, or a problem with the WhatsApp account.
- 404 The number, template, message, broadcast, webhook, delivery, opt-in, logged request, booking or Flow was not found.
- 409 Idempotency-Key: the first request with this key is still running, or did not finish. Or a conflict: the template name exists, the webhook URL is used by another webhook, the broadcast cannot be cancelled, the booking slot is taken or the booking is already cancelled, or the Flow is not published.
- 415 The body is not JSON.
- 429 A monthly plan limit, the number's own monthly cap, the key's daily cap, a WhatsApp rate limit, the API rate limit (rate_limited), or the webhook test limit (too_many_tests) was reached. Retry-After and error.retry_after_seconds say how long to wait.
- 500 Unexpected error on app2email's side.
- 502 WhatsApp (Meta) returned an error or could not be reached.
- 503 app2email's connection to the WhatsApp account needs attention, or the request log is not available right now.