---
title: "Start Salesforce Opportunity payment setup"
description: "For an eligible Salesforce Opportunity, resolves or creates the customer and bootstrap contact from Account.Email__c, provisions customer portal access, creates a durable payment setup intent, and either sends or returns the one-time link."
---

> Documentation Index
> Fetch the complete documentation index at: https://my.caretlegal.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

Path: External Customer Access API

`POST /integrations/external-clients/salesforce/opportunity-payment-setup`

For an eligible Salesforce Opportunity, resolves or creates the customer and bootstrap contact from Account.Email__c, provisions customer portal access, creates a durable payment setup intent, and either sends or returns the one-time link.

## Authentication

- `PartnerApiKey`, http, header `Authorization`

## Request body

_Required._

- `source` (`startSalesforceOpportunityPaymentSetup.source`; string, required)
  - default `"salesforce"`
- `account_id` (`startSalesforceOpportunityPaymentSetup.account_id`; string, required) — Salesforce Account Id.
- `contact_email` (`startSalesforceOpportunityPaymentSetup.contact_email`; string, required) — Authorized bootstrap email. For CARET Legal v1 this is Salesforce Account.Email__c.
  - format `email`
- `opportunity_id` (`startSalesforceOpportunityPaymentSetup.opportunity_id`; string, required) — Salesforce Opportunity Id.
- `account_name` (`startSalesforceOpportunityPaymentSetup.account_name`; string, optional) — Required when create_if_missing is true.
- `contact_id` (`startSalesforceOpportunityPaymentSetup.contact_id`; string, optional) — Optional Salesforce Contact Id. Omit when Account.Email__c is the bootstrap recipient.
- `contact_first_name` (`startSalesforceOpportunityPaymentSetup.contact_first_name`; string, optional)
- `contact_last_name` (`startSalesforceOpportunityPaymentSetup.contact_last_name`; string, optional)
- `stage_name` (`startSalesforceOpportunityPaymentSetup.stage_name`; string, optional) — Optional eligibility guard for CARET Legal onboarding.
  - default `"4 - Proposal"`
- `mode` (`startSalesforceOpportunityPaymentSetup.mode`; string, optional)
  - one of `"send"`, `"return_link"`; default `"send"`
- `create_if_missing` (`startSalesforceOpportunityPaymentSetup.create_if_missing`; boolean, optional)
  - default `false`
- `token_expires_in_seconds` (`startSalesforceOpportunityPaymentSetup.token_expires_in_seconds`; integer, optional)
  - min 300; max 604800; default `604800`
- `redirect_path` (`startSalesforceOpportunityPaymentSetup.redirect_path`; string, optional) — Optional in-app redirect path. Defaults to the Salesforce Opportunity payment setup route.
- `Deal_Room_URL__c` (`startSalesforceOpportunityPaymentSetup.Deal_Room_URL__c`; string, optional) — Salesforce Opportunity Deal Room URL used by the confirmation return action.
  - format `uri`
- `salesforceReturnUrl` (`startSalesforceOpportunityPaymentSetup.salesforceReturnUrl`; string, optional, deprecated) — Compatibility alias for Deal_Room_URL__c.
  - format `uri`
- `returnCtaLabel` (`startSalesforceOpportunityPaymentSetup.returnCtaLabel`; string, optional)
  - default `"Return to Deal Room"`
- `metadata` (`startSalesforceOpportunityPaymentSetup.metadata`; object, optional)

## Example requests

### Account-email bootstrap send mode

```json
{
  "source": "salesforce",
  "account_id": "001xx000003DGbYAAW",
  "account_name": "Example Law",
  "contact_email": "owner@example.com",
  "opportunity_id": "006xx000004XYZAAA4",
  "stage_name": "4 - Proposal",
  "mode": "send",
  "create_if_missing": true,
  "returnCtaLabel": "Return to Deal Room"
}
```

### Account-email bootstrap return-link mode

```json
{
  "source": "salesforce",
  "account_id": "001xx000003DGbYAAW",
  "account_name": "Example Law",
  "contact_email": "owner@example.com",
  "opportunity_id": "006xx000004XYZAAA4",
  "stage_name": "4 - Proposal",
  "mode": "return_link",
  "create_if_missing": true,
  "Deal_Room_URL__c": "https://deal-room.example.com/opportunities/006xx000004XYZAAA4"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.caretlegal.net/integrations/external-clients/salesforce/opportunity-payment-setup \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "salesforce",
  "account_id": "001xx000003DGbYAAW",
  "account_name": "Example Law",
  "contact_email": "owner@example.com",
  "opportunity_id": "006xx000004XYZAAA4",
  "stage_name": "4 - Proposal",
  "mode": "send",
  "create_if_missing": true,
  "returnCtaLabel": "Return to Deal Room"
}
'
```

### TypeScript

```typescript
const url = 'https://api.caretlegal.net/integrations/external-clients/salesforce/opportunity-payment-setup';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    source: 'salesforce',
    account_id: '001xx000003DGbYAAW',
    account_name: 'Example Law',
    contact_email: 'owner@example.com',
    opportunity_id: '006xx000004XYZAAA4',
    stage_name: '4 - Proposal',
    mode: 'send',
    create_if_missing: true,
    returnCtaLabel: 'Return to Deal Room'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.caretlegal.net/integrations/external-clients/salesforce/opportunity-payment-setup"

payload = {
    "source": "salesforce",
    "account_id": "001xx000003DGbYAAW",
    "account_name": "Example Law",
    "contact_email": "owner@example.com",
    "opportunity_id": "006xx000004XYZAAA4",
    "stage_name": "4 - Proposal",
    "mode": "send",
    "create_if_missing": True,
    "returnCtaLabel": "Return to Deal Room"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Magic link returned

#### Example

```json
{
  "success": true,
  "data": {
    "paymentSetupIntentId": "d5f22666-bb3c-442e-bf88-2d5dcb5913ae",
    "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
    "status": "created",
    "source": "salesforce",
    "provider": "salesforce",
    "account_id": "string",
    "contact_id": "string",
    "opportunity_id": "string",
    "externalCustomerId": "string",
    "externalContactId": "string",
    "opportunityId": "string",
    "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
    "contactId": "b5ec5d98-4bee-4da1-ad24-dde86346cb1d",
    "clerkOrganizationId": "string",
    "clerkUserId": "string",
    "salesforceCustomerMappingCreated": true,
    "caretCustomerMappingCreated": true,
    "caretContactMappingCreated": true,
    "clerkOrganizationMappingCreated": true,
    "clerkUserMappingCreated": true,
    "netsuiteCustomerId": "string",
    "netsuiteContactId": "string",
    "netsuiteCustomerCreated": true,
    "netsuiteCustomerMappingCreated": true,
    "netsuiteContactMappingCreated": true,
    "customerAccessStatus": "payment_setup_enabled",
    "paymentOnlyAccess": true,
    "magicLinkSent": true,
    "magicLinkUrl": "http://example.com",
    "redirectPath": "string",
    "returnCtaLabel": "string",
    "salesforceReturnUrl": "http://example.com",
    "tokenExpiresInSeconds": 0,
    "tokenExpiresAt": "2019-08-24T14:15:22Z",
    "communicationId": "string",
    "messageId": "string"
  }
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.200.success`; boolean, required)
- `data` (`startSalesforceOpportunityPaymentSetup.response.200.data`; object, required)
  - `paymentSetupIntentId` (`startSalesforceOpportunityPaymentSetup.response.200.data.paymentSetupIntentId`; string, optional)
    - format `uuid`
  - `organizationId` (`startSalesforceOpportunityPaymentSetup.response.200.data.organizationId`; string, optional) — Local organization created or resolved by the platform from the Salesforce payload.
    - format `uuid`
  - `status` (`startSalesforceOpportunityPaymentSetup.response.200.data.status`; string, optional)
    - one of `"created"`, `"link_sent"`, `"link_returned"`, `"started"`, `"completed"`, `"failed"`
  - `source` (`startSalesforceOpportunityPaymentSetup.response.200.data.source`; string, optional)
  - `provider` (`startSalesforceOpportunityPaymentSetup.response.200.data.provider`; string, optional)
  - `account_id` (`startSalesforceOpportunityPaymentSetup.response.200.data.account_id`; string, optional) — Salesforce Account Id.
  - `contact_id` (`startSalesforceOpportunityPaymentSetup.response.200.data.contact_id`; string, optional, nullable) — Salesforce Contact Id when supplied; null for Account-email bootstrap.
  - `opportunity_id` (`startSalesforceOpportunityPaymentSetup.response.200.data.opportunity_id`; string, optional) — Salesforce Opportunity Id.
  - `externalCustomerId` (`startSalesforceOpportunityPaymentSetup.response.200.data.externalCustomerId`; string, optional)
  - `externalContactId` (`startSalesforceOpportunityPaymentSetup.response.200.data.externalContactId`; string, optional, nullable)
  - `opportunityId` (`startSalesforceOpportunityPaymentSetup.response.200.data.opportunityId`; string, optional)
  - `customerId` (`startSalesforceOpportunityPaymentSetup.response.200.data.customerId`; string, optional)
    - format `uuid`
  - `contactId` (`startSalesforceOpportunityPaymentSetup.response.200.data.contactId`; string, optional)
    - format `uuid`
  - `clerkOrganizationId` (`startSalesforceOpportunityPaymentSetup.response.200.data.clerkOrganizationId`; string, optional)
  - `clerkUserId` (`startSalesforceOpportunityPaymentSetup.response.200.data.clerkUserId`; string, optional)
  - `salesforceCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.salesforceCustomerMappingCreated`; boolean, optional)
  - `caretCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.caretCustomerMappingCreated`; boolean, optional)
  - `caretContactMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.caretContactMappingCreated`; boolean, optional)
  - `clerkOrganizationMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.clerkOrganizationMappingCreated`; boolean, optional)
  - `clerkUserMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.clerkUserMappingCreated`; boolean, optional)
  - `netsuiteCustomerId` (`startSalesforceOpportunityPaymentSetup.response.200.data.netsuiteCustomerId`; string, optional, nullable) — Resolved NetSuite customer internal id when a NetSuite customer has externalid equal to the Salesforce account_id.
  - `netsuiteContactId` (`startSalesforceOpportunityPaymentSetup.response.200.data.netsuiteContactId`; string, optional, nullable) — Resolved NetSuite contact internal id when a contact is found under the resolved NetSuite customer.
  - `netsuiteCustomerCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.netsuiteCustomerCreated`; boolean, optional) — True when the platform created a NetSuite customer because no customer existed with externalid equal to the Salesforce account_id.
  - `netsuiteCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.netsuiteCustomerMappingCreated`; boolean, optional)
  - `netsuiteContactMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.200.data.netsuiteContactMappingCreated`; boolean, optional)
  - `customerAccessStatus` (`startSalesforceOpportunityPaymentSetup.response.200.data.customerAccessStatus`; string, optional)
    - example `"payment_setup_enabled"`
  - `paymentOnlyAccess` (`startSalesforceOpportunityPaymentSetup.response.200.data.paymentOnlyAccess`; boolean, optional)
  - `magicLinkSent` (`startSalesforceOpportunityPaymentSetup.response.200.data.magicLinkSent`; boolean, optional)
  - `magicLinkUrl` (`startSalesforceOpportunityPaymentSetup.response.200.data.magicLinkUrl`; string, optional) — Short CARET onboarding URL, present only for return_link mode and suitable for the 255-character Salesforce field.
    - format `uri`
  - `redirectPath` (`startSalesforceOpportunityPaymentSetup.response.200.data.redirectPath`; string, optional)
  - `returnCtaLabel` (`startSalesforceOpportunityPaymentSetup.response.200.data.returnCtaLabel`; string, optional)
  - `salesforceReturnUrl` (`startSalesforceOpportunityPaymentSetup.response.200.data.salesforceReturnUrl`; string, optional)
    - format `uri`
  - `tokenExpiresInSeconds` (`startSalesforceOpportunityPaymentSetup.response.200.data.tokenExpiresInSeconds`; integer, optional)
  - `tokenExpiresAt` (`startSalesforceOpportunityPaymentSetup.response.200.data.tokenExpiresAt`; string, optional)
    - format `date-time`
  - `communicationId` (`startSalesforceOpportunityPaymentSetup.response.200.data.communicationId`; string, optional)
  - `messageId` (`startSalesforceOpportunityPaymentSetup.response.200.data.messageId`; string, optional)

### 202

Magic-link send accepted

#### Example

```json
{
  "success": true,
  "data": {
    "paymentSetupIntentId": "d5f22666-bb3c-442e-bf88-2d5dcb5913ae",
    "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
    "status": "created",
    "source": "salesforce",
    "provider": "salesforce",
    "account_id": "string",
    "contact_id": "string",
    "opportunity_id": "string",
    "externalCustomerId": "string",
    "externalContactId": "string",
    "opportunityId": "string",
    "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
    "contactId": "b5ec5d98-4bee-4da1-ad24-dde86346cb1d",
    "clerkOrganizationId": "string",
    "clerkUserId": "string",
    "salesforceCustomerMappingCreated": true,
    "caretCustomerMappingCreated": true,
    "caretContactMappingCreated": true,
    "clerkOrganizationMappingCreated": true,
    "clerkUserMappingCreated": true,
    "netsuiteCustomerId": "string",
    "netsuiteContactId": "string",
    "netsuiteCustomerCreated": true,
    "netsuiteCustomerMappingCreated": true,
    "netsuiteContactMappingCreated": true,
    "customerAccessStatus": "payment_setup_enabled",
    "paymentOnlyAccess": true,
    "magicLinkSent": true,
    "magicLinkUrl": "http://example.com",
    "redirectPath": "string",
    "returnCtaLabel": "string",
    "salesforceReturnUrl": "http://example.com",
    "tokenExpiresInSeconds": 0,
    "tokenExpiresAt": "2019-08-24T14:15:22Z",
    "communicationId": "string",
    "messageId": "string"
  }
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.202.success`; boolean, required)
- `data` (`startSalesforceOpportunityPaymentSetup.response.202.data`; object, required)
  - `paymentSetupIntentId` (`startSalesforceOpportunityPaymentSetup.response.202.data.paymentSetupIntentId`; string, optional)
    - format `uuid`
  - `organizationId` (`startSalesforceOpportunityPaymentSetup.response.202.data.organizationId`; string, optional) — Local organization created or resolved by the platform from the Salesforce payload.
    - format `uuid`
  - `status` (`startSalesforceOpportunityPaymentSetup.response.202.data.status`; string, optional)
    - one of `"created"`, `"link_sent"`, `"link_returned"`, `"started"`, `"completed"`, `"failed"`
  - `source` (`startSalesforceOpportunityPaymentSetup.response.202.data.source`; string, optional)
  - `provider` (`startSalesforceOpportunityPaymentSetup.response.202.data.provider`; string, optional)
  - `account_id` (`startSalesforceOpportunityPaymentSetup.response.202.data.account_id`; string, optional) — Salesforce Account Id.
  - `contact_id` (`startSalesforceOpportunityPaymentSetup.response.202.data.contact_id`; string, optional, nullable) — Salesforce Contact Id when supplied; null for Account-email bootstrap.
  - `opportunity_id` (`startSalesforceOpportunityPaymentSetup.response.202.data.opportunity_id`; string, optional) — Salesforce Opportunity Id.
  - `externalCustomerId` (`startSalesforceOpportunityPaymentSetup.response.202.data.externalCustomerId`; string, optional)
  - `externalContactId` (`startSalesforceOpportunityPaymentSetup.response.202.data.externalContactId`; string, optional, nullable)
  - `opportunityId` (`startSalesforceOpportunityPaymentSetup.response.202.data.opportunityId`; string, optional)
  - `customerId` (`startSalesforceOpportunityPaymentSetup.response.202.data.customerId`; string, optional)
    - format `uuid`
  - `contactId` (`startSalesforceOpportunityPaymentSetup.response.202.data.contactId`; string, optional)
    - format `uuid`
  - `clerkOrganizationId` (`startSalesforceOpportunityPaymentSetup.response.202.data.clerkOrganizationId`; string, optional)
  - `clerkUserId` (`startSalesforceOpportunityPaymentSetup.response.202.data.clerkUserId`; string, optional)
  - `salesforceCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.salesforceCustomerMappingCreated`; boolean, optional)
  - `caretCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.caretCustomerMappingCreated`; boolean, optional)
  - `caretContactMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.caretContactMappingCreated`; boolean, optional)
  - `clerkOrganizationMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.clerkOrganizationMappingCreated`; boolean, optional)
  - `clerkUserMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.clerkUserMappingCreated`; boolean, optional)
  - `netsuiteCustomerId` (`startSalesforceOpportunityPaymentSetup.response.202.data.netsuiteCustomerId`; string, optional, nullable) — Resolved NetSuite customer internal id when a NetSuite customer has externalid equal to the Salesforce account_id.
  - `netsuiteContactId` (`startSalesforceOpportunityPaymentSetup.response.202.data.netsuiteContactId`; string, optional, nullable) — Resolved NetSuite contact internal id when a contact is found under the resolved NetSuite customer.
  - `netsuiteCustomerCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.netsuiteCustomerCreated`; boolean, optional) — True when the platform created a NetSuite customer because no customer existed with externalid equal to the Salesforce account_id.
  - `netsuiteCustomerMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.netsuiteCustomerMappingCreated`; boolean, optional)
  - `netsuiteContactMappingCreated` (`startSalesforceOpportunityPaymentSetup.response.202.data.netsuiteContactMappingCreated`; boolean, optional)
  - `customerAccessStatus` (`startSalesforceOpportunityPaymentSetup.response.202.data.customerAccessStatus`; string, optional)
    - example `"payment_setup_enabled"`
  - `paymentOnlyAccess` (`startSalesforceOpportunityPaymentSetup.response.202.data.paymentOnlyAccess`; boolean, optional)
  - `magicLinkSent` (`startSalesforceOpportunityPaymentSetup.response.202.data.magicLinkSent`; boolean, optional)
  - `magicLinkUrl` (`startSalesforceOpportunityPaymentSetup.response.202.data.magicLinkUrl`; string, optional) — Short CARET onboarding URL, present only for return_link mode and suitable for the 255-character Salesforce field.
    - format `uri`
  - `redirectPath` (`startSalesforceOpportunityPaymentSetup.response.202.data.redirectPath`; string, optional)
  - `returnCtaLabel` (`startSalesforceOpportunityPaymentSetup.response.202.data.returnCtaLabel`; string, optional)
  - `salesforceReturnUrl` (`startSalesforceOpportunityPaymentSetup.response.202.data.salesforceReturnUrl`; string, optional)
    - format `uri`
  - `tokenExpiresInSeconds` (`startSalesforceOpportunityPaymentSetup.response.202.data.tokenExpiresInSeconds`; integer, optional)
  - `tokenExpiresAt` (`startSalesforceOpportunityPaymentSetup.response.202.data.tokenExpiresAt`; string, optional)
    - format `date-time`
  - `communicationId` (`startSalesforceOpportunityPaymentSetup.response.202.data.communicationId`; string, optional)
  - `messageId` (`startSalesforceOpportunityPaymentSetup.response.202.data.messageId`; string, optional)

### 400

Invalid request

#### Example

```json
{
  "success": false,
  "error": "string",
  "details": [
    {}
  ]
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.400.success`; boolean, required)
- `error` (`startSalesforceOpportunityPaymentSetup.response.400.error`; string, required)
- `details` (`startSalesforceOpportunityPaymentSetup.response.400.details`; array<object>, optional)

### 401

Invalid API key

#### Example

```json
{
  "success": false,
  "error": "string",
  "details": [
    {}
  ]
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.401.success`; boolean, required)
- `error` (`startSalesforceOpportunityPaymentSetup.response.401.error`; string, required)
- `details` (`startSalesforceOpportunityPaymentSetup.response.401.details`; array<object>, optional)

### 403

Missing scope

#### Example

```json
{
  "success": false,
  "error": "string",
  "details": [
    {}
  ]
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.403.success`; boolean, required)
- `error` (`startSalesforceOpportunityPaymentSetup.response.403.error`; string, required)
- `details` (`startSalesforceOpportunityPaymentSetup.response.403.details`; array<object>, optional)

### 409

Wrong Opportunity stage or duplicate guard block

#### Example

```json
{
  "success": false,
  "error": "string",
  "details": [
    {}
  ]
}
```

- `success` (`startSalesforceOpportunityPaymentSetup.response.409.success`; boolean, required)
- `error` (`startSalesforceOpportunityPaymentSetup.response.409.error`; string, required)
- `details` (`startSalesforceOpportunityPaymentSetup.response.409.details`; array<object>, optional)


Source: https://my.caretlegal.com/docs/reference/external-clients/startSalesforceOpportunityPaymentSetup/index.md
