Related API: This extension modifies the Update Credit operation.
| Action Type | HTTP |
|---|---|
| Full Action ID | http.commerce.customer.credits.updateCredit.after |
| Runs multiple custom functions? | Yes |
JavaScript File Structure
Action files share the following basic structure:callback—This argument follows the established JavaScript callback pattern: it takes an error as the first argument (or null if there is no error) and a result as the second argument (if required).
context—This argument provides the function access to relevant objects and methods that interface with Kibo eCommerce.
Context: HTTP
The methods and objects documented here are available to this action through the use of thecontext argument.
REST API OperationThis action corresponds to the api/commerce/customer/credits/updateCredit operation. HTTP Request PUT
api/commerce/customer/credits/{code}?responseFields={responseFields}
Request BodyUse context.request.body to read/write the HTTP request body using this action. Response Body
Use context.response.body to write the HTTP response body using this action.
Context Objects Available to All HTTP Actions
request
Accesses the current HTTP request. In the case of Before actions, updates can be made to the request before Kibo eCommerce processes it.
*Available only for Storefront HTTP actions.
|
| query | object | The request query. |
| href | string | The request href. |
| secure | Boolean | Indicates whether the request uses HTTPS. |
| ip | string | The request IP address. |
| ips | string | The request secure IP address. |
| body | object | The request body of the API operation associated with this action. |
Example:
response
Accesses the current HTTP response. For both Before and After actions, updates can be made to the response before Kibo eCommerce processes it.
*Available only for Storefront HTTP actions.
|
| viewName | string |
The response viewName value.
*Available only for Storefront HTTP actions.
|
| body | object | The response body of the API operation associated with this action. |
| status | integer | The response status code. |
| message | string | The response message. |
| length | integer | The response length. |
| type | string | The response type. |
Example:
Context Methods Available to All HTTP Actions
request.get
Returns an HTTP header value for the specified header key.
Example:
response.get
Gets a field from the response.
Example:
response.set
Sets the HTTP headers for the response.
Example:
response.set2
Updates a field in the response.
Example:
response.remove
Removes an HTTP header from the response.
Example:
response.redirect
Redirects the incoming URL.
Example:
response.end
Ends the response so that other actions or Kibo eCommerce logic can run. Also, signals the callback to complete.
Example:
get.resource
Returns the currently persisted value of the requested resource. **Not available for all calls.
Example:
get.resourceStatus
Gets the HTTP resource status.
Example:
items.urlHelper.getUrl
Gets the current URL.
Example:
Context Objects Available to All Actions
apiContext
Accesses Kibo eCommerce tenant information.
Example:
configuration
Receives a JSON response that contains information about the configuration data set in the Action Management JSON editor.
Example:

