The Order Transactions API allows you to manage records and details of payments and refunds associated with your orders.
With the Order Transactions API you can:
To use the Order Transactions API, import { orderTransactions }
from the wix-ecom-backend
module:
import { orderTransactions } from "wix-ecom-backend";
Functions in the Order Transactions API are restricted and only run if you elevate permissions using the wix-auth
elevate()
function.
Warning: Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Adds up to 50 payment records to an order.
The addPayments()
function returns a Promise that resolves when the payment records are added to an order.
Note: This does NOT perform the actual charging - the order is only updated with records of the payments.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function addPayments(
orderId: string,
payments: Array<Payment>,
): Promise<AddPaymentsResponse>;
Order ID.
Payments to be added to order.
import { orderTransactions } from "wix-ecom-backend";
async function addPayments(orderId, payments) {
try {
const result = await orderTransactions.addPayments(orderId, payments);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates multiple order payments with a specified status.
The bulkUpdatePaymentStatus()
function returns a Promise that resolves when the payment statuses are updated.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function bulkUpdatePaymentStatuses(
paymentAndOrderIds: Array<PaymentAndOrderId>,
options: BulkUpdatePaymentStatusesOptions,
): Promise<BulkUpdatePaymentStatusesResponse>;
Order and payment IDs for which to update payment status.
import { orderTransactions } from "wix-ecom-backend";
async function bulkUpdatePaymentStatuses(paymentAndOrderIds, options) {
try {
const result = await orderTransactions.bulkUpdatePaymentStatuses(
paymentAndOrderIds,
options,
);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves information about payments and refunds associated with all specified orders.
The listTransactionsForMultipleOrders()
function returns a Promise that resolves when the specified orders' transaction records are retrieved.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listTransactionsForMultipleOrders(
orderIds: Array<string>,
): Promise<ListTransactionsForMultipleOrdersResponse>;
Order IDs for which to retrieve transactions.
import { orderTransactions } from "wix-ecom-backend";
async function listTransactionsForMultipleOrders(orderIds) {
try {
const result =
await orderTransactions.listTransactionsForMultipleOrders(orderIds);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves information about payments and refunds associated with a specified order.
The listTransactionsForSingleOrder()
function returns a Promise that resolves when the specified order's transaction records are retrieved.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listTransactionsForSingleOrder(
orderId: string,
): Promise<ListTransactionsForSingleOrderResponse>;
Order ID.
import { orderTransactions } from "wix-ecom-backend";
async function listTransactionsForSingleOrder(orderId) {
try {
const result =
await orderTransactions.listTransactionsForSingleOrder(orderId);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates the status of an order's payment.
The updatePaymentStatus()
function returns a Promise that resolves when the payment status is updated.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updatePaymentStatus(
identifiers: UpdatePaymentStatusIdentifiers,
options: UpdatePaymentStatusOptions,
): Promise<UpdatePaymentStatusResponse>;
import { orderTransactions } from "wix-ecom-backend";
async function updatePaymentStatus(identifiers, options) {
try {
const result = await orderTransactions.updatePaymentStatus(
identifiers,
options,
);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.