Payments and refunds
Payment states, line refunds, authorization voids, and webhook recovery.
/dashboard/platform/payments needs canManagePayments. Data comes from groceryPlatformPayments.
Payment states
Payment.status: pending, authorized, processing, succeeded, failed, cancelled, refunded, partially_refunded. Checkout authorizes; finalizing the sale captures.
Refunds
- By line:
getGroceryOrderRefundLines(orderId)lists refundable lines.refundGroceryOrderLines(orderId, paymentId, idempotencyKey, reason, lines)refunds the selected lines. Each line has a disposition ofreturn_to_stock,waste, orquarantine; unsafe or expired goods cannot go back to stock. Loyalty points earned on the lines are reversed. - By amount:
refundPayment. - The reason must be 3 to 500 characters.
- A
PaymentRefundisprocessing,succeeded,failed, orcanceled.reconcilePaymentRefundsand theworker:refund-reconcileprocess check pending refunds with the provider.
Void an authorization
voidGroceryPaymentAuthorization(paymentId, reason, idempotencyKey) releases a hold that has not been captured. It refuses while a final sale is processing.
Recovery
recoverGroceryPaymentCreationfinishes a payment that was created at the provider but not recorded. It needs the checkout session, the provider payment reference, and a reason.groceryPaymentWebhookRecoverylists storedPaymentWebhookEventrows andreplayPaymentWebhookEventreplays one with a review reason of 3 to 500 characters.
See Payment providers.