4. Get Payouts

Payouts API Endpoint Documentation

This documentation provides details on the GET endpoint for fetching payouts based on various filters.

Endpoint

https://brands.gotoaisle.com/api/v1/[brandId]/payouts

Method

GET

Parameters

Path Parameters:

  • brandId: ID of the brand you want to fetch payouts for. This should be provided in the URL as https://brands.gotoaisle.com/api/v1/[brandId]/payouts.

Query Parameters:

  • startDate (optional): The start date to filter the payouts by paidAt property. The expected format is YYYY-MM-DD.
  • endDate (optional): The end date to filter the payouts by paidAt property. The expected format is YYYY-MM-DD. If startDate is provided, endDate must also be provided.
  • limit (optional): Limit the number of records returned. Defaults to 100 if not provided. Max value is 250.
  • nextPageToken (optional): If you have more records than the limit, you can use the token provided in the previous response to fetch the next set of records.

Responses

Success Response:

{
  "recordsCount": number,
  "payouts": [
    {
      // payout details
    },
    ...
  ],
  "nextPageToken": "encodedToken" // provided if there are more records to fetch
}

Error Response:

{
  "error": "Error message detailing what went wrong."
}

Example

Fetching payouts for brand with ID 1234:

GET https://brands.gotoaisle.com/api/v1/1234/payouts?startDate=2023-01-01&endDate=2023-01-31&limit=50

Successful Response

{
  "payouts": [
    {
      "id": "payout1234",
      "paidAt": "2023-09-07T10:00:00.000Z",
      "createdAt": "2023-09-07T10:00:00.000Z",
      "amount": 100.5,
      "customerId": "cust1234",
      "campaignId": "camp1234",
      "conversation": {
        "signupId": "signup1234",  // new field
        "email": "john.doe@example.com",
        "emailFiltered": null,
        "customerPhoneNumber": "7890",
        "referrerUrl": null,       // new field
        "utmSource": null,         // new field
        "utmCampaign": null,       // new field
        "utmMedium": null,         // new field
        "influencerTag": null      // new field
      },
      "image": {
        "url": "https://example.com/image1.jpg",
        "city": "Los Angeles",
        "streetAddress": "123 LA St",
        "zipCode": "90001",
        "merchant": null,           // new field
        "skus": [
          {
            "quantity": 1,
            "sku": {
              "name": "Sour",
              "product": {
                "name": "Candy"
              }
            }
          }
        ]
      }
    },
    {
      "id": "payout5678",
      "paidAt": "2023-09-05T08:30:00.000Z",
      "createdAt": "2023-09-05T08:30:00.000Z",
      "amount": 55.25,
      "customerId": "cust5678",
      "campaignId": "camp5678",
      "conversation": {
        "signupId": "signup5678",  // new field
        "email": "jane+smith@gmail.com",
        "emailFiltered": "jane@gmail.com",
        "customerPhoneNumber": "4321",
        "referrerUrl": null,       // new field
        "utmSource": null,         // new field
        "utmCampaign": null,       // new field
        "utmMedium": null,         // new field
        "influencerTag": null      // new field
      },
      "image": null
    }
  ],
  "recordsCount": 2,
  "nextPageToken": "abcd1234token"
}

Response Model

export interface Payout {
  id: string;
  paidAt: Date:
  createdAt: Date;
  amount: number;
  customerId: string;
  campaignId: string;
  conversation: {
    signupId: string;
    email: string | null;
    emailFiltered: string | null;
    customerPhoneNumber: string;
    referrerUrl: string | null;
    utmSource: string | null;
    utmCampaign: string | null;
    utmMedium: string | null;
    influencerTag: string | null;
  };
  image: {
    url: string;
    city: string | null;
    streetAddress: string | null;
    zipCode: string | null;
    skus: {
      quantity: number;
      sku: {
        name: string;
        product: {
          name: string;
        };
      };
    }[];
  } | null;
}
 
export interface GetPayoutsResponse {
  payouts: Payout[];
  recordsCount: number;
  nextPageToken?: string;
}

Notes

  • Always ensure the date format for startDate and endDate is YYYY-MM-DD.
  • If you provide a startDate, you must also provide an endDate.

For further details or issues, contact our developer support.