LogoLogo
  • LiquidCommerce Documentation
  • πŸ”Authentication API Integration
    • Get Access Token
  • Services
    • πŸ—ΊοΈAddress API
      • Autocomplete
      • Details
    • πŸ‘₯Users API
      • Session
      • Fetch User
      • Delete User
      • Create/Update Address
      • Delete Address
      • Add Payment
      • Update Default Payment
      • Delete Payment
    • πŸ—ƒοΈCatalog API
      • Search
      • Availability
    • πŸ›’Cart API
      • Create/Update Cart
    • πŸ›οΈCheckout API
      • Prepare
      • Complete
    • πŸ“Orders API
      • Authentication
      • Get Order
  • CLOUD SDK
    • Overview
    • Methods & Usage
  • EVENTS & ERRORS
    • Overview
    • Cart Events
    • Checkout Status Codes
  • EVENT BRIDGE (WEBHOOKS)
    • Orders
  • Types
    • Loc
    • Catalog
    • Catalog Filters
    • Product
    • Cart
    • User
    • Retailer
    • Checkout
    • Order
Powered by GitBook
On this page
  • Endpoint Details
  • Headers
  • Body
  • Response Details
  • Sample Request and Response
Export as PDF
  1. Services
  2. Users API

Add Payment

Add a new payment method to a user by ID

Endpoint Details

POST /users/payments/add

Headers

Header
Value

Content-Type

application/json

Authorization

Bearer <YOUR_ACCESS_TOKEN>

Body

Parameter
Type
Description
Required

userId

string

Identifier of the user to add payment method for

paymentMethodId

string

isDefault

boolean

Set as default payment method (default: false)

Response Details

Field
Type
Description

statusCode

number

HTTP status code of the response

message

string

A brief message describing the result of the API call

metadata

Contains metadata about the API call

auth

Authentication object, only when refresh in true

data

User payment details

Metadata Object

Sample Request and Response

curl --location 'https://staging.api.liquidcommerce.cloud/users/payments/add' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "customerId": "usrid_123abc456def",
    "paymentMethodId": "paymentid_123abc456def",
    "isDefault": true
}'
{
    "statusCode": 201,
    "message": "Adding an new payment method succeeded",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731625068720,
        "timezone": "UTC",
        "requestId": "requestid_123abc456def",
        "path": "/api/users/payments/add",
        "version": "1.7.0"
    },
    "data": {
        "id": "paymentid_123abc456def",
        "type": "card",
        "isDefault": true,
        "card": {
            "brand": "visa",
            "country": "US",
            "expMonth": 11,
            "expYear": 2031,
            "last4": "1111",
            "funding": "credit"
        },
        "createdAt": "2024-11-14T22:57:49.094Z"
    }
}
PreviousDelete AddressNextUpdate Default Payment

Last updated 5 months ago

Payment method ID or new payment token, you must use the to mount/inject a paymentElement to be able to generate a payment token.

πŸ‘₯
CLOUD SDK
metaDataObject
authObject
userPayment
Field
Type
Description

languages

Array<string>

List of supported languages for the response, e.g. ["en"]

timestamp

string

Unix timestamp (in milliseconds) when the response was generated

timezone

string

Timezone used for the response, always "UTC"

requestId

string

Unique identifier for the API request. Used for debugging and support

path

string

API path

version

string

API version used for the request