Update a client's points balance (gain)
PATCH
https://api-v2.test.eldowallet.fr/clients/:id/gain
Replaces a client's points balance (gain) and updates their loyalty card. Returns the updated client.
Good to know
gainis the new balance, not an increment. Sending the current balance returns204(NOTHING_TO_UPDATE). Each change is added togainHistory; theEARNINGS_UPDATEpush is sent if the notification template enables it and the client has not opted out. Fires theclient.updatedwebhook.
Request
path parameters
idstring requiredClient ID (24-character hexadecimal ObjectId).
header parameters
x-langstringLanguage for responsesenum:en,frdefault:"en"
Body
application/json requiredgainnumber required
Responses
- 200
- 400
- 401
- 403
- 404
- 500
- 503
Schema
application/jsonwalletstringclientTypeoneOf- ClientType
storeCardoneOf required- StoreCard
walletoneOf required- Wallet
- option 2
cardTypestring requiredenum:STORE_CARD,MEMBER_CARDdisplayIdentifiantboolean requireddisplayWalletNamebooleanstripstring requiredpassBuilderPassTemplateIdstringprogramNamestringkeysHasChangedstring[]startRowstringenum:CREATION_DATE,EXPIRATION_DATE,BIRTHDATE,GAIN,CLUB,ASSOCIATION,ORGANISATION,ENTREPRISE,N_LICENCE,N_ADHERENT,N_MEMBER,MEMBER,N_IMMATRICULATION,INACTIVE,ADMISSION_DATEmiddleRowstringenum:CREATION_DATE,EXPIRATION_DATE,BIRTHDATE,GAIN,CLUB,ASSOCIATION,ORGANISATION,ENTREPRISE,N_LICENCE,N_ADHERENT,N_MEMBER,MEMBER,N_IMMATRICULATION,INACTIVE,ADMISSION_DATEendRowstringenum:CREATION_DATE,EXPIRATION_DATE,BIRTHDATE,GAIN,CLUB,ASSOCIATION,ORGANISATION,ENTREPRISE,N_LICENCE,N_ADHERENT,N_MEMBER,MEMBER,N_IMMATRICULATION,INACTIVE,ADMISSION_DATEiosHeaderobjectlabelEnumstring requiredenum:TYPE,GAIN,FULLNAME,CUSTOM_TEXT,INACTIVEvalueEnumstring requiredenum:TYPE,GAIN,FULLNAME,CUSTOM_TEXT,INACTIVEcustomLabelstringcustomValuestring
barcodeTypestring requiredenum:AZTEC,CODE_128,PDF_417,QR_CODE,NONEdescriptionsobject[] requiredtitlestring requiredvaluestring required
openingHoursstring requiredcolorsobject requiredlabelColorstring requiredbackgroundColorstring requiredforegroundColorstring required
oneTimeToUseboolean requiredsharingProhibitedboolean requiredsharingProhibitedAndroidboolean requiredvalidityobject requiredexpirationTypestring requiredenum:NO_EXPIRATION,AT_DATETIME,AFTER_PERIODexpirationDatestring <date-time>expirationAfterPeriodstringexpirationPeriodTypestringenum:YEARS,MONTHS,WEEKSexpirationOptionstringenum:AT_CREATION_DATE,END_OF_MONTH
gainLabelstring requiredenum:GAIN,GAINS,CAGNOTE,POINTSgainUnitstring requiredenum:NONE,EURO,USD,MAD,POINTSofferLabelstring requiredenableDisplayIdentifiantboolean requiredgainFormatMigratedboolean requiredMarks whether the PassBuilder template and all existing passes have been migrated to the new gain format where the unit symbol is embedded in the pass attribute value (e.g. "50 Pts") rather than in the template field. False (or absent) means the old format is still in use._idstring requiredcreatedAtstring <date-time> requiredupdatedAtstring <date-time> required
- option 2
- StoreCard
namestring requiredisDefaultboolean required_idstring requiredcreatedAtstring <date-time> requiredupdatedAtstring <date-time> required
- option 2
- ClientType
passStatusstringStatus of the associated store card passenum:active,inactive,deleted,canceled,expiredexample:activedeviceTypesstringComma-separated list of unique device typesexample:IOS, ANDROIDshortLinkstringShort URL for the pass inscription page (e.g. for QR codes)shortIdstring4-char short id for the pass (used in short links)passBuilderPassIdstringPassBuilder pass id (used in short links when shortId absent)passIdstringPass idclientTypeNamestringClient type nameotherPassStatusesobjectLive pass status for this client's non-loyalty passes (event/transit/hotel), keyed by pass category. Undefined for a category means the client has no such pass yet — used to gate "new pass"-dependent communication preferences (a client cannot meaningfully opt in/out of notifications for a pass they don't have yet).eventstringenum:active,inactive,deleted,canceled,expiredtransitstringenum:active,inactive,deleted,canceled,expiredhotelstringenum:active,inactive,deleted,canceled,expired
sourcestring requiredenum:CRM,INTERNAL,EXTERNALbarcodestringfirstNamestring requiredlastNamestring requiredemailstringcompanyNamestringrenewalDatestring <date-time>phoneNumberstringbirthDatestring <date-time>admissionDatestring <date-time>gainnumbergainHistoryobject[]gainnumber requireddatestring <date-time> required
communicationPreferencesobject[]Per-event, per-channel communication preference overrides for this client (GDPR consent management). Same shape as `WalletSetting.communicationRules` — reused rather than duplicated. No entry for a given notificationType means enabled, mirroring `isCommunicationRuleEnabled`'s existing semantics. Change history is intentionally NOT embedded here — see `CommunicationPreferenceLog` — to keep this frequently-read document small.notificationTypestring requiredenum:NEW_LOYALTY,UPDATE_LOYALTY,REMINDER_LOYALTY,EARNINGS_UPDATE,NEW_COMMUNICATION,EXPIRED_COMMUNICATION,NEW_EVENT,UPDATE_EVENT,NEW_COUPON,UPDATE_COUPON,WELCOME_INTERNAL_CLIENTS,WELCOME_CRM_CLIENTS,WELCOME_EXTERNAL_CLIENTS,WELCOME_COUPON,EXPIRED_COUPON,TRANSIT_TICKET,UPDATE_TRANSIT,HOTEL_RESERVATION,UPDATE_HOTEL_RESERVATION,CINEMA_TICKETsmsboolean requiredemailboolean requirednotificationboolean required
pushInformativeEnabledbooleanOpt-out of manager-created "standard" push campaigns classified as informative.pushCommercialEnabledbooleanOpt-out of manager-created "standard" push campaigns classified as commercial._idstring requiredcreatedAtstring <date-time> requiredupdatedAtstring <date-time> required
VALIDATION_ERROR · INVALID_JSON
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email
UNAUTHORIZED
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email
FORBIDDEN
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email
MODEL_NOT_FOUND
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email
UNKNOWN_ERROR
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email
PASS_BUILDER_ERROR
Schema
application/jsonmessagestring requiredexample:Promo code already existserrorCodestring requiredexample:400:PROMO_CODE_ALREADY_EXISTSpathstring requiredexample:/couponsdatestring <date-time> requireddetailsobjectvalidationErrorsobject[]fieldstringexample:emailmessagestringexample:email must be an email