Search.../

addPayments( )

Developer Preview

Adds up to 50 payment records to an order.

Description

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.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function addPayments(orderId: string, payments: Array<Payment>): Promise<AddPaymentsResponse>

addPayments Parameters

NAME
TYPE
DESCRIPTION
orderId
string

Order ID.

payments
Array<
Payment
>

Payments to be added to order.

Returns

Return Type:

Promise<
AddPaymentsResponse
>
NAME
TYPE
DESCRIPTION
orderTransactions
OrderTransactions

Order ID and its associated transactions.

paymentsIds
Array<
string
>

IDs of added order payments.

Was this helpful?

addPayments example

Copy Code
1import { orderTransactions } from 'wix-ecom-backend';
2
3 async function addPayments(orderId, payments) {
4 try {
5 const result = await orderTransactions.addPayments(orderId, payments);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13