Create Usage Charge

The Create Usage Charge API is used to create usage-based charges for a recurring application charge within Shoplazza. This API allows app developers to bill merchants based on their additional usage exceeding the amount defined in their recurring subscription.

This API is especially useful for:

  1. Charging merchants for usage-based services like API requests, storage, or additional features.
  2. Monitoring and recording usage-related charges within a subscription plan.
  3. Ensuring merchants are billed within the capped amount set during subscription.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

ParameterTypeRequiredDescriptionExample
recurring_charge_idstringYesThe ID of the recurring charge."372269669345671159"

Body Parameters

ParameterTypeRequiredDescriptionExample
usage_chargeobjectYesThe usage charge object.{...}
descriptionstringYesDescription of the usage charge."Additional storage fee"
pricefloatYesAmount to charge for this usage.10.00

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

FieldTypeDescriptionExample
idstringUnique identifier for the usage charge."3722736344521766903"
descriptionstringDescription of the usage charge."API Requests Fee"
testbooleanIndicates if the charge is a test charge.false
balance_usedstringThe amount already used in the current billing cycle."3.00"
balance_remainingstringThe remaining balance available in the capped amount."7.00"
created_atstringTimestamp when the usage charge was created."2024-04-23T06:40:51Z"

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorsArray[ "file number error"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorString "page not found"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404Not FoundThe charge Id is not found or empty."Record not found"

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!