Update user payment
Use this API to update the payment details for an existing user.
HTTP Request
POST <BASE_URL>/api/v1/users
Headers
| Header | Type | Description |
|---|---|---|
cv-api-key | string | Required. Your unique API key for authentication. |
Content-Type | string | Required. Must be application/json. |
Request Body
The request body is a JSON object with two top-level fields: action and data.
| Field | Type | Description |
|---|---|---|
action | string | Required. The action to be performed. This should always be UPDATE_PAYMENT_INFO. |
data | object | An object containing the payment details. |
updatePayment Object
| Field | Type | Description |
|---|---|---|
email | string | Required. The user's email address. |
stripeSetupId | string | Required. The Stripe setup ID. |
nmiPaymentToken | string | Required. The NMI payment token. |
shippingAddress | object | Required. The shipping address. |
shippingAddress Object
| Field | Type | Description |
|---|---|---|
addressLine1 | string | Required. The address of the user. |
addressLine2 | string | Required. The address2 of the user. |
city | string | Required. The city of the user. |
state | string | Required. The state of the user. |
country | string | Required. The country of the user. |
postalCode | string | Required. The postal code of the user. |
Example Request
curl --location '<BASE_URL>/api/v1/users' \
--header 'cv-api-key: <redacted>' \
--header 'Content-Type: application/json' \
--data-raw '{
"action": "UPDATE_PAYMENT_INFO",
"email": "john.doe@carevalidate.com",
"data": {
"stripeSetupId": "<redacted>",
"nmiPaymentToken": "<redacted>",
"shippingAddress": {
"addressLine1": "1600 Pennsylvania Avenue NW",
"addressLine2": "",
"city": "Washington",
"state": "DC",
"country": "US",
"postalCode": "20500"
}
}
}'
Responses
Success Response
A successful request returns a 200 status code and a JSON object confirming the email update.
Response
{
"status": 200,
"success": true,
"data": {
"code": "PAYMENT_SETUP_UPDATED"
}
}
Failure Responses
A request can fail for several reasons, returning an error status code and a JSON object with a descriptive message.
User does not exist
If the email provided in the request body doesn't match an existing user, the API will return this response.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "User {email} does not exist",
}
If the stripeSetupId provided in the request body doesn't match an existing setup intent, the API will return this response.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "No such setupintent: 'seti_1SNZDLKAXrtjbq2duGldHsHf'"
}