Introduction

 

Developer Preview
APIs in Developer Preview are subject to change and are not intended for use in production.
Send us your suggestions for improving this API. Your feedback is valuable to us.

 

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:

Terminology

  • Transaction: Global term for a transfer of funds. Can be either a:
    • Payment: A transfer of funds from customer to merchant/seller when making a purchase.
    • Refund A reimbursing transfer of funds back to the buyer.

To use the Order Transactions API, import { orderTransactions } from the wix-ecom-backend module:

Copy
import { orderTransactions } from "wix-ecom-backend";

Permissions information

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.

Did this help?

addPayments( )


Developer Preview

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function addPayments(
  orderId: string,
  payments: Array<Payment>,
): Promise<AddPaymentsResponse>;
Method Parameters
orderIdstringRequired

Order ID.


paymentsArray<Payment>Required

Payments to be added to order.

Returns
Return Type:Promise<AddPaymentsResponse>
JavaScript
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 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

bulkUpdatePaymentStatuses( )


Developer Preview

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function bulkUpdatePaymentStatuses(
  paymentAndOrderIds: Array<PaymentAndOrderId>,
  options: BulkUpdatePaymentStatusesOptions,
): Promise<BulkUpdatePaymentStatusesResponse>;
Method Parameters
paymentAndOrderIdsArray<PaymentAndOrderId>Required

Order and payment IDs for which to update payment status.


optionsBulkUpdatePaymentStatusesOptions
Returns
Return Type:Promise<BulkUpdatePaymentStatusesResponse>
JavaScript
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 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

listTransactionsForMultipleOrders( )


Developer Preview

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function listTransactionsForMultipleOrders(
  orderIds: Array<string>,
): Promise<ListTransactionsForMultipleOrdersResponse>;
Method Parameters
orderIdsArray<string>Required

Order IDs for which to retrieve transactions.

Returns
Return Type:Promise<ListTransactionsForMultipleOrdersResponse>
JavaScript
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 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

listTransactionsForSingleOrder( )


Developer Preview

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function listTransactionsForSingleOrder(
  orderId: string,
): Promise<ListTransactionsForSingleOrderResponse>;
Method Parameters
orderIdstringRequired

Order ID.

Returns
Return Type:Promise<ListTransactionsForSingleOrderResponse>
JavaScript
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 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

updatePaymentStatus( )


Developer Preview

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function updatePaymentStatus(
  identifiers: UpdatePaymentStatusIdentifiers,
  options: UpdatePaymentStatusOptions,
): Promise<UpdatePaymentStatusResponse>;
Method Parameters
identifiersUpdatePaymentStatusIdentifiersRequired

optionsUpdatePaymentStatusOptions
Returns
Return Type:Promise<UpdatePaymentStatusResponse>
JavaScript
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 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?