ordersRetryPaymentWithHttpInfo method
Retry an order's payment
Charges the wallet again for an order whose payment failed. Available only while the order is paymentPending and has no completed payment, as actions.paymentRetry shows; otherwise the call returns 400 with code 10001. Orders created in the dashboard and paid by card must be retried in the dashboard. Returns the order id, its status and the new payment attempt. When the charge succeeds the order becomes paid and fulfillment starts; when it fails again payment.failure carries 16000 (PAYMENT_FAILED). A concurrent retry of the same order returns 409. Requires an Idempotency-Key header (a UUID). Repeating a completed request with the same key returns 409 with code 12000 (IDEMPOTENCY_KEY_ALREADY_USED) instead of charging again; one still running returns 409 with code 12002. A request that ended in an error can be sent again with the same key and body. Use a new key for each new retry attempt.
Note: This method returns the HTTP Response.
Parameters:
Implementation
Future<Response> ordersRetryPaymentWithHttpInfo(String orderId, String idempotencyKey, { Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/orders/{orderId}/payment/retry'
.replaceAll('{orderId}', orderId);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
headerParams[r'Idempotency-Key'] = parameterToString(idempotencyKey);
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
abortTrigger: abortTrigger,
);
}