Seller payouts
Introduction
The marketplace operator is able to create and approve payouts to marketplace sellers by capturing all eligible orders in a payout window.
A payout moves through these statuses: CREATING while it is built, then DRAFT, LOCKED, PROCESSING and finally PAID. Only one payout can be in CREATING, DRAFT, LOCKED, PROCESSING or ERROR at a time.
Orders that are ready for payout
Each seller order has a payoutStatus. A payout collects the orders that are READY_FOR_PAYOUT.
With the AUTOMATED_BY_FULFILLMENT payout automation strategy (payoutAutomationStrategy in the marketplace configuration), Traide sets it for you: an order is READY_FOR_PAYOUT once it is paid, fully or partly, and fulfilled, partially fulfilled or delivered. Unpaid, unfulfilled and canceled orders stay NOT_READY. With the MANUAL strategy, Traide does not change payoutStatus on its own.
To see the orders a new payout would collect, filter on payoutStatus:
{
orders(
first: 100
sortBy: { field: CREATION_DATE, direction: DESC }
filter: { payoutStatus: [READY_FOR_PAYOUT] }
) {
edges {
node {
id
number
payoutStatus
}
}
}
}
Response:
{
"data": {
"orders": {
"edges": [
{
"node": {
"id": "T3JkZXI6Nw==",
"number": "7",
"payoutStatus": "READY_FOR_PAYOUT"
}
}
]
}
}
}
Create the draft payout
To create a payout, run the payoutCreateAsync mutation with the last day of the payout window:
mutation {
payoutCreateAsync(input: { endDate: "2022-10-31" }) {
payout {
id
status
endDate
}
payoutErrors {
field
message
code
}
}
}
The payout starts in CREATING status while Traide collects the eligible orders into one seller payout per seller, then moves to DRAFT:
{
"data": {
"payoutCreateAsync": {
"payout": {
"id": "UGF5b3V0Ojc=",
"status": "CREATING",
"endDate": "2022-10-31"
},
"payoutErrors": []
}
}
}
The endDate must be on or before today's date.
View list of payouts
To see your payouts, past and present, use the payouts query. This example shows only the most recent one:
{
payouts(first: 1, sortBy: { field: CREATED, direction: DESC }) {
edges {
node {
id
name
status
created
endDate
}
}
pageInfo {
hasPreviousPage
hasNextPage
}
}
}
Response:
{
"data": {
"payouts": {
"edges": [
{
"node": {
"id": "UGF5b3V0Ojc=",
"name": "2022-10-31",
"status": "DRAFT",
"created": "2022-10-31",
"endDate": "2022-10-31"
}
}
],
"pageInfo": {
"hasPreviousPage": false,
"hasNextPage": true
}
}
}
}
View payout details
To get details about a payout, use the payout query with the payout's ID. The draft payout we just created has the ID "UGF5b3V0Ojc=". Here are some of the fields you can query; see the Payout type in GraphiQL's Docs panel for the full list:
{
payout(id: "UGF5b3V0Ojc=") {
vendors
vendorPayouts(first: 100) {
edges {
node {
id
seller {
id
companyName
}
status
}
}
}
status
endDate
netSales {
currency
amount
}
adjustments {
currency
amount
}
payout {
currency
amount
}
}
}
Response:
{
"data": {
"payout": {
"vendors": 1,
"vendorPayouts": {
"edges": [
{
"node": {
"id": "VmVuZG9yUGF5b3V0OjY=",
"seller": {
"id": "U2VsbGVyOjQ=",
"companyName": "Example Seller"
},
"status": "UNPAID"
}
}
]
},
"status": "DRAFT",
"endDate": "2022-10-31",
"netSales": {
"currency": "USD",
"amount": 14.99
},
"adjustments": {
"currency": "USD",
"amount": 0
},
"payout": {
"currency": "USD",
"amount": 14.99
}
}
}
}
Only one seller is in this payout, and they have yet to be paid. A payout has one seller payout per seller with orders ready for payout.
Apply adjustments to a payout
You can adjust what a seller receives in a draft payout for any number of reasons. An adjustment is a signed amount, in the marketplace's currency: a positive value adds to the seller payout and a negative value deducts from it.
Use payoutUpdate with the seller's ID, "U2VsbGVyOjQ=" above. This example adds 5:
mutation {
payoutUpdate(
id: "UGF5b3V0Ojc="
input: { vendorPayouts: [{ vendorId: "U2VsbGVyOjQ=", adjustments: 5 }] }
) {
payout {
id
status
adjustments {
currency
amount
}
payout {
currency
amount
}
}
payoutErrors {
field
message
code
}
}
}
penalties is deprecated. A value passed in it is added to adjustments, so pass a negative adjustments value instead.
Exclude select sellers from a payout
To leave sellers out of a draft payout, you need the IDs of their seller payouts (vendorPayouts), which the payout query above returns. Here the seller payout ID is "VmVuZG9yUGF5b3V0OjY=".
The mutation is vendorPayoutsBulkExclude. It takes ids, the seller payout IDs to exclude.
At least one seller must remain in the payout, otherwise the mutation returns an error.
mutation {
vendorPayoutsBulkExclude(ids: ["VmVuZG9yUGF5b3V0OjY="]) {
count
payoutErrors {
field
message
code
}
}
}
Lock a payout so it can be completed
Once the adjustments and exclusions are done, lock the payout so it can no longer be changed. Use payoutStatusUpdate with the payout ID:
mutation {
payoutStatusUpdate(id: "UGF5b3V0Ojc=", input: { status: "locked" }) {
payout {
id
name
status
}
payoutErrors {
field
message
code
}
}
}
To make the payout editable again, run the same mutation with status set to "draft".
Complete the payout
To pay the sellers, run payoutProcess on the locked payout:
id: the payout ID.isManual:falsepays each seller through the payout gateway configured for that seller, such as Stripe Connect.truerecords the seller payouts as paid without a gateway, for payouts you issue yourself outside Traide.
mutation {
payoutProcess(input: { id: "UGF5b3V0Ojc=", isManual: false }) {
payout {
id
status
}
payoutErrors {
field
message
code
}
}
}
The payout moves to PROCESSING while the sellers are paid:
{
"data": {
"payoutProcess": {
"payout": {
"id": "UGF5b3V0Ojc=",
"status": "PROCESSING"
},
"payoutErrors": []
}
}
}
When every seller payout is paid, the payout's status is PAID and the sellers receive an email that their payout has been processed. If a seller payout fails, the payout moves to ERROR; you can run payoutProcess on it again.