Returnista ACTION
Create Draft Return Order
Creates a new draft return order for a consumer. Draft return orders are pending merchant review before being accepted or rejected. Use Process Draft Return Order to accept or reject the created draft. See the documentation
- Action
- Writes data
- API key
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Returnista account once, then configure and run Create Draft Return Order from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "returnista-create-draft-return-order",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
returnista: { authProvisionId: "apn_xxxxxxx" },
consumerId: "Consumer ID",
purchaseId: "Purchase ID",
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "returnista-create-draft-return-order",
"configured_props": {
"returnista": { "authProvisionId": "apn_xxxxxxx" },
"consumerId": "Consumer ID",
"purchaseId": "Purchase ID"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "returnista",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "returnista-create-draft-return-order",
arguments: {
consumerId: "Consumer ID",
purchaseId: "Purchase ID",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
consumerId Consumer ID | string | The unique identifier of the consumer in Returnista. To find a consumer ID, use Get Return Orders or Get Return Order — the consumer ID is included directly in the response. Required |
purchaseId Purchase ID | string | The ID of the purchase to return. Use Get Consumer Purchases to find purchase IDs. Required |
returnReasonId Return Reason ID | string | The UUID of the return reason. Use Get Return Reasons to find available IDs. Leave blank to submit without a reason (sends null). Optional |
returnReasonComment Return Reason Comment | string | An optional free-text comment explaining the return reason. Optional |
resolutionType Resolution Type | string | The desired resolution type for the return. Optional |
exchangeProductId Exchange Product ID | string | The ID of the shipping product to exchange for. Typically required when resolutionType is Exchange. Use List Shipping Products to find available product IDs. Optional |
exchangeOptionSku Exchange Option SKU | string | The SKU of the product variant to exchange for. Typically required when resolutionType is Exchange. Optional |
answers Answers | string[] | Array of form field answers for the return questionnaire. Each entry is a stringified JSON object with formField and answer. Example entry: {"formField":{"id":"uuid-here","type":"SingleChoice","required":true},"answer":"value"}. answer can also be an array of strings (MultiChoice) or an array of file objects: [{"mimeType":"image/jpeg","url":"https://..."}]. Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- returnista-create-draft-return-order
- Version
- 0.0.2
- App
- Returnista
- Authentication
- API key
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗