# Payments & payouts

## Set up Stripe Connect payment account

POST `/stripe-connect`

This endpoint lets you set up a payment account.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Body request**

```json
{
    "businessType": "individual",
    "country": "US",
    "type": "account_onboarding"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Account link generated for existing account",
    "data": {
        "accountId": "acct_1SYRWXI4WYBuh0bZ",
        "status": "pending",
        "onboardingUrl": "https://connect.stripe.com/setup/e/acct_1SYRWXI4WYBuh0bZ/qZY54ZwiHYKT",
        "expiresAt": 1764336091,
        "isExistingAccount": true
    }
}
```

{% endtab %}
{% endtabs %}

## Get payment account link

POST `/stripe-connect/account-link`

This endpoint lets you get a payment account link.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Body request**

```json
{
     "type": "account_onboarding" 
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    {
    "success": true,
    "message": "Account link generated successfully",
    "data": {
        "accountId": "acct_1SYRWXI4WYBuh0bZ",
        "onboardingUrl": "https://connect.stripe.com/setup/e/acct_1SYRWXI4WYBuh0bZ/zYXA0kMAybIg",
        "expiresAt": 1764336465
    }
}
```

{% endtab %}
{% endtabs %}

## Get Stripe Connect status

GET `/stripe-connect/status`

This endpoint lets you get the status of a Stripe Connect account.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Account status retrieved successfully",
    "data": {
        "accountId": "acct_1SYRWXI4WYBuh0bZ",
        "status": "restricted",
        "onboardingCompleted": false,
        "payoutsEnabled": false,
        "paymentsEnabled": false,
        "requiresAction": true,
        "requirements": {
            "currentlyDue": [
                "business_profile.mcc",
                "business_profile.url",
                "external_account",
                "individual.address.city",
                "individual.address.line1",
                "individual.address.postal_code",
                "individual.address.state",
                "individual.dob.day",
                "individual.dob.month",
                "individual.dob.year",
                "individual.email",
                "individual.first_name",
                "individual.last_name",
                "individual.phone",
                "individual.ssn_last_4",
                "settings.payments.statement_descriptor",
                "tos_acceptance.date",
                "tos_acceptance.ip"
            ],
            "eventuallyDue": [
                "business_profile.mcc",
                "business_profile.url",
                "external_account",
                "individual.address.city",
                "individual.address.line1",
                "individual.address.postal_code",
                "individual.address.state",
                "individual.dob.day",
                "individual.dob.month",
                "individual.dob.year",
                "individual.email",
                "individual.first_name",
                "individual.last_name",
                "individual.phone",
                "individual.ssn_last_4",
                "settings.payments.statement_descriptor",
                "tos_acceptance.date",
                "tos_acceptance.ip"
            ],
            "pastDue": [
                "business_profile.mcc",
                "business_profile.url",
                "external_account",
                "individual.address.city",
                "individual.address.line1",
                "individual.address.postal_code",
                "individual.address.state",
                "individual.dob.day",
                "individual.dob.month",
                "individual.dob.year",
                "individual.email",
                "individual.first_name",
                "individual.last_name",
                "individual.phone",
                "individual.ssn_last_4",
                "settings.payments.statement_descriptor",
                "tos_acceptance.date",
                "tos_acceptance.ip"
            ],
            "pendingVerification": []
        },
        "disabledReason": "requirements.past_due",
        "email": null,
        "businessProfile": {
            "annual_revenue": null,
            "estimated_worker_count": null,
            "mcc": null,
            "minority_owned_business_designation": null,
            "name": null,
            "support_address": null,
            "support_email": null,
            "support_phone": null,
            "support_url": null,
            "url": null
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Get all payouts

GET `/stores/{store_id}/payouts?`

This endpoint lets you get all payouts for a store.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "success": true,
  "message": "Store payouts retrieved successfully",
  "data": {
    "payouts": [
      {
        "_id": "672355f432116c6197fbf242",
        "orderCode": "SO-12345678",
        "totalAmount": 107.98,
        "transferAmount": 102.99,
        "platformFeeAmount": 5.00,
        "transferStatus": "transferred",
        "transferredAt": "2024-01-15T10:30:00.000Z",
        "stripeTransferId": "tr_1234567890abcdef",
        "createdAt": "2024-01-15T10:00:00.000Z",
        "store": {
          "_id": "692565f432118c6197abf2ec",
          "name": "My Awesome Store",
          "storeUrl": "my-awesome-store"
        }
      },
      {
        "_id": "672355f432116c6197fbf243",
        "orderCode": "SO-12345679",
        "totalAmount": 249.99,
        "transferAmount": 237.49,
        "platformFeeAmount": 12.50,
        "transferStatus": "pending",
        "transferredAt": null,
        "stripeTransferId": "tr_0987654321fedcba",
        "createdAt": "2024-01-16T14:20:00.000Z",
        "store": {
          "_id": "692565f432118c6197abf2ec",
          "name": "My Awesome Store",
          "storeUrl": "my-awesome-store"
        }
      }
    ],
    "pagination": {
      "currentPage": 1,
      "totalPages": 1,
      "totalPayouts": 2,
      "hasNextPage": true,
      "hasPrevPage": false
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Get payout summary

GET `/stores/{store_id}/payouts/summary`

This endpoint lets you get a payout summary.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Payout summary retrieved successfully",
    "data": {
        "summary": {
            "transferred": {
                "count": 0,
                "totalAmount": 0,
                "transferAmount": 0,
                "platformFeeAmount": 0
            },
            "pending": {
                "count": 0,
                "totalAmount": 0,
                "transferAmount": 0,
                "platformFeeAmount": 0
            },
            "failed": {
                "count": 0,
                "totalAmount": 0,
                "transferAmount": 0,
                "platformFeeAmount": 0
            }
        },
        "payoutTrend": [],
        "pendingTransfers": {
            "totalPending": 0,
            "count": 0
        },
        "totalLifetimePayouts": 0,
        "totalLifetimeFees": 0
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.searchagora.com/store-builder/payments-and-payouts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
