Account payment profile API handlers
Manage user payment profiles (saved credit cards/payment methods).
GET Account Payment Profile Collection
HTTP Verb – GET
URL – /api/v1/accounts/current/paymentprofiles
Description – Get a collection of payment profiles for the current user
Base – HandlerBase<GetAccountPaymentProfileCollectionParameter, GetAccountPaymentProfileCollectionResult>
Handlers –
| Order | Handler | Description |
|---|---|---|
| 500 | GetPaymentProfilesQuery | Creates the base query for UserPaymentProfile entities filtered by the current user's UserProfileId. |
| 600 | ApplyExpands | If parameter GetCustomProperties is true, includes CustomProperties in the query via eager loading. |
| 700 | ApplyFiltering | If parameter AccountPaymentProfileId is specified, filters query by that Id. If parameter Query is specified, filters by Description containing that text. |
| 800 | ApplySort | If parameter Sort is blank, sorts by IsDefault descending, then by Description, CardType, and MaskedCardNumber. If Sort is specified, validates the sort property exists on UserPaymentProfile and applies dynamic ordering. Returns error if sort property is invalid. |
| 900 | ApplyPaging | Applies standard paging to the query using the base ApplyPaging method. |
| 1000 | ExecuteQuery | Executes the query by calling ToList() and sets the result to UserPaymentProfiles. |
| 1100 | CreateGetAccountPaymentProfileResults | Creates a GetAccountPaymentProfileResult for each UserPaymentProfile in the collection. If GetCustomProperties is true, copies custom properties to each result. |
GET Account Payment Profile
HTTP Verb – GET
URL – /api/v1/accounts/current/paymentprofiles/{AccountPaymentProfileId}
Description – Get a single payment profile by Id
Base – HandlerBase<GetAccountPaymentProfileParameter, GetAccountPaymentProfileResult>
Handlers –
| Order | Handler | Description |
|---|---|---|
| 500 | GetPaymentProfile | Calls GetAccountPaymentProfileCollection with the specified AccountPaymentProfileId. If the collection result fails, returns an error. If no results are found, returns a NotFound error. Otherwise returns the first result. |
POST Account Payment Profile
HTTP Verb – POST
URL – /api/v1/accounts/current/paymentprofiles
Description – Add a new payment profile for the current user
Base – HandlerBase<AddAccountPaymentProfileParameter, AddAccountPaymentProfileResult>
Handlers –
| Order | Handler | Description |
|---|---|---|
| 500 | AddPaymentProfile | Creates a new UserPaymentProfile entity from the parameter values (Description, ExpirationDate, CardType, CardHolderName, CardIdentifier, MaskedCardNumber, Address fields, IsDefault, TokenScheme). Integrates with payment gateways (Square, Spreedly, Paymetric) to store payment profiles when applicable. Validates that a duplicate card does not already exist for the user. If IsDefault is true, sets all other user payment profiles to not default. Inserts the entity and saves. |
PATCH Account Payment Profile
HTTP Verb – PATCH
URL – /api/v1/accounts/current/paymentprofiles/{AccountPaymentProfileId}
Description – Update an existing payment profile
Base – HandlerBase<UpdateAccountPaymentProfileParameter, UpdateAccountPaymentProfileResult>
Handlers –
| Order | Handler | Description |
|---|---|---|
| 500 | GetPaymentProfile | Retrieves the existing payment profile by calling GetAccountPaymentProfile with the specified AccountPaymentProfileId. Returns error if not found. |
| 600 | UpdatePaymentProfile | Updates the UserPaymentProfile fields (Description, ExpirationDate, CardHolderName, Address fields, IsDefault) with parameter values where provided. If IsDefault is set to true, sets all other user payment profiles to not default. Saves changes. |
DELETE Account Payment Profile
HTTP Verb – DELETE
URL – /api/v1/accounts/current/paymentprofiles/{AccountPaymentProfileId}
Description – Remove a payment profile
Base – HandlerBase<RemoveAccountPaymentProfileParameter, RemoveAccountPaymentProfileResult>
Handlers –
| Order | Handler | Description |
|---|---|---|
| 500 | GetPaymentProfile | Retrieves the existing payment profile by calling GetAccountPaymentProfile with the specified AccountPaymentProfileId. Returns error if not found. |
| 600 | RemovePaymentProfile | Deletes the UserPaymentProfile entity from the repository and saves changes. |
Updated about 9 hours ago
