Gets an order by ID for the currently logged-in member.
The memberGetOrder()
function returns a Promise that resolves to information about a specified order for the currently logged-in member.
function memberGetOrder(
_id: string,
options: MemberGetOrderOptions,
): Promise<Order>;
Order ID.
Options for getting a logged-in member's order.
import { Permissions, webMethod } from "wix-web-module";
import { orders } from "wix-pricing-plans.v2";
// Sample _id: '7b4ec42c-582a-4e2f-874b-09e66e0ae09d'
export const memberGetOrder = webMethod(Permissions.Anyone, async (_id) => {
try {
const order = await orders.memberGetOrder(_id);
return order;
} catch (error) {
console.error(error);
// Handle the error
}
});
/* Promise resolves to:
* {
* "_createdDate": "2024-01-28T08:35:15.230Z",
* "_id": "7b4ec42c-582a-4e2f-874b-09e66e0ae09d",
* "_updatedDate": "2024-01-28T08:35:16.080Z",
* "buyer": {
* "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
* "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
* },
* "currentCycle": {
* "index": 1,
* "startedDate": "2024-01-28T08:35:15.230Z"
* },
* "cycles": [
* {
* "index": 1,
* "startedDate": "2024-01-28T08:35:15.230Z"
* }
* ],
* "formData": {
* "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",
* "submissionData": {},
* "submissionId": "2cf62c7a-d3ed-4dd9-816d-01919aaf2170"
* },
* "lastPaymentStatus": "NOT_APPLICABLE",
* "orderMethod": "UNKNOWN",
* "pausePeriods": [],
* "planDescription": "Full functionality for new users",
* "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",
* "planName": "Standard Plan",
* "planPrice": "0",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "planPrice": "0",
* "singlePaymentUnlimited": true,
* "subtotal": "0.00",
* "total": "0"
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "0.00",
* "total": "0"
* }
* }
* ],
* "singlePaymentUnlimited": true
* },
* "startDate": "2024-01-28T08:35:15.230Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "subscriptionId": "08bc02c5-7663-4578-948a-ff23370e07e5",
* "type": "ONLINE"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.