Create a charge for a specific account

POST /accounts/{account_id}/line_items/charges

Path parameters

  • account_id string Required

    Account ID

Body Required

Body of request to create charge

  • line_item_id string

    The ID associated to be with the line item for future requests. If not provided on line item creation, Canopy will generate this field.

    Format should match the following pattern: ^(?!can_).*$.

  • line_item_status string

    The status of a line item.

    Values are VALID, INVALID, OFFSET, PENDING, AUTHORIZED, DECLINED, VOID, or POSTED. Default value is VALID.

  • original_amount_cents integer Required

    The amount charged (in cents).

    Default value is 0.

  • effective_at string(date-time)

    The Date-Time that the charge is made applicable to the account. Although a charge may be made today, it can be set effective 10 days prior.

  • merchant_data object | null
    Hide merchant_data attributes Show merchant_data attributes object | null
    • name string
    • id string
    • mcc_code string
    • phone_number string
  • issuer_processor_metadata object
    Hide issuer_processor_metadata attribute Show issuer_processor_metadata attribute object
    • lithic object
      Hide lithic attribute Show lithic attribute object
      • last_four string

        Last four digits of the card against which the spend was made.

  • external_fields array[object] | null

    External fields can be used to associate this record to entities in external systems.

    Not more than 100 elements.

    Hide external_fields attributes Show external_fields attributes array[object] | null
    • key string

      Key - i.e. Name of the External Party

    • value string

      Value - i.e. External Account ID

  • Additional properties are NOT allowed

Responses

  • default

    Unexpected Error.

  • 200

    Charge Created

    Hide response attributes Show response attributes object
    • account_id string Required

      The account associated with the line item

    • line_item_id string Required

      The ID associated with the line item

    • effective_at string(date-time)

      The Date-Time that this line item became/becomes active

    • created_at string(date-time)

      The Date-Time which the line item was created.

    • product_id string Required

      the Product ID of the account

    • line_item_summary object
      Hide line_item_summary attributes Show line_item_summary attributes object
      • original_amount_cents integer

        The originating amount of money (in cents) relating to this line item.

      • balance_cents integer

        The current balance of the line item, which accounts for interest accrued per the product's interest policy and the account's interest rate attribute.

      • principal_cents integer

        The principal balance of the line item.

      • interest_balance_cents integer

        The current interest balance of the line item.

      • am_interest_balance_cents integer

        The current AM interest balance of the line item. Canopy tracks interest during an amortization period separately from deferred interest accrued during a revolving period.

      • deferred_interest_balance_cents integer

        The current deferred interest balance of the line item.

      • am_deferred_interest_balance_cents integer

        The current AM deferred interest balance of the line item. Canopy tracks deferred interest during an amortization period separately from deferred interest accrued during a revolving period.

      • total_interest_paid_to_date_cents integer

        The sum (in cents) of all payments towards interest charges, if any, applied to this line item to date

    • merchant_data object | null

      Merchant information if applicable.

      Hide merchant_data attributes Show merchant_data attributes object | null
      • name string
      • id string
      • mcc_code number
      • phone_number string
    • issuer_processor_details object | null
      Hide issuer_processor_details attribute Show issuer_processor_details attribute object | null
      • lithic object
        Hide lithic attributes Show lithic attributes object
        • last_four string | null

          Last four digits of the card against which the spend was made.

        • transaction_token string(uuid) | null

          The external unique identifier of the transaction.

        • card_token string(uuid) | null

          The external unique identifier of the card related to this line item.

    • external_fields array[object] | null

      An array of static references to fields in a third party system.

      Not more than 1000 elements.

      Hide external_fields attributes Show external_fields attributes array[object] | null
      • key string

        Key - i.e. Name of the External Party

      • value string

        Value - i.e. External Account ID

    • line_item_overview object
      Hide line_item_overview attributes Show line_item_overview attributes object
      • line_item_status string

        The status of a line item.

        Values are VALID, INVALID, OFFSET, PENDING, AUTHORIZED, DECLINED, VOID, or POSTED. Default value is VALID.

      • line_item_type string Required

        The line item type CHARGE

        Default value is CHARGE.

      • description string | null

        A description of this particular line item if any. More common for adjustments.

    • Additional properties are allowed
  • 401

    Unauthorized.

  • 403

    Forbidden.

  • 422

    Invalid input

  • 429

    Too many requests.

POST /accounts/{account_id}/line_items/charges
curl \
 -X POST https://sandbox-api.canopyservicing.com/accounts/31mNprzLd2bKl6koVna68ARM/line_items/charges \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"line_item_id":"0x1234","line_item_status":"VALID","original_amount_cents":200,"effective_at":"2020-07-20T09:11:28+00:00","merchant_data":{"name":"string","id":"string","mcc_code":"string","phone_number":"string"},"issuer_processor_metadata":{"lithic":{"last_four":"string"}},"external_fields":[{"key":"Globex Card Processing Account ID","value":"22445702-a389-431f-927d-07b8d0750787"}]}'
Request example
{
  "line_item_id": "0x1234",
  "line_item_status": "VALID",
  "original_amount_cents": 200,
  "effective_at": "2020-07-20T09:11:28+00:00",
  "merchant_data": {
    "name": "string",
    "id": "string",
    "mcc_code": "string",
    "phone_number": "string"
  },
  "issuer_processor_metadata": {
    "lithic": {
      "last_four": "string"
    }
  },
  "external_fields": [
    {
      "key": "Globex Card Processing Account ID",
      "value": "22445702-a389-431f-927d-07b8d0750787"
    }
  ]
}
Request examples
{
  "line_item_id": "0x1234",
  "line_item_status": "VALID",
  "original_amount_cents": 200,
  "effective_at": "2020-07-20T09:11:28+00:00",
  "merchant_data": {
    "name": "string",
    "id": "string",
    "mcc_code": "string",
    "phone_number": "string"
  },
  "issuer_processor_metadata": {
    "lithic": {
      "last_four": "string"
    }
  },
  "external_fields": [
    {
      "key": "Globex Card Processing Account ID",
      "value": "22445702-a389-431f-927d-07b8d0750787"
    }
  ]
}
Response examples (200)
{
  "account_id": 4,
  "line_item_id": 2,
  "effective_at": "2018-07-20T09:12:30+00:00",
  "created_at": "2018-06-20T09:12:30+00:00",
  "product_id": 1,
  "line_item_summary": {
    "original_amount_cents": 2484,
    "balance_cents": 3600,
    "principal_cents": 2400,
    "interest_balance_cents": 1100,
    "am_interest_balance_cents": 0,
    "deferred_interest_balance_cents": 200,
    "am_deferred_interest_balance_cents": 0,
    "total_interest_paid_to_date_cents": -16
  },
  "merchant_data": {
    "name": "string",
    "id": "string",
    "mcc_code": 42.0,
    "phone_number": "string"
  },
  "issuer_processor_details": {
    "lithic": {
      "last_four": 3324,
      "transaction_token": "33xd08bc-d100-488y-bb93-f8a1f081ff0e",
      "card_token": "c6cd08bc-c524-48f5-b64d-f79ec0810df4"
    }
  },
  "external_fields": [
    {
      "key": "Globex Card Processing Account ID",
      "value": "22445702-a389-431f-927d-07b8d0750787"
    }
  ],
  "line_item_overview": {
    "line_item_status": "VALID",
    "line_item_type": "CHARGE",
    "description": "Charge against the account"
  }
}
Response examples (200)
{
  "account_id": 4,
  "line_item_id": 2,
  "effective_at": "2018-07-20T09:12:30+00:00",
  "created_at": "2018-06-20T09:12:30+00:00",
  "product_id": 1,
  "line_item_summary": {
    "original_amount_cents": 2484,
    "balance_cents": 3600,
    "principal_cents": 2400,
    "interest_balance_cents": 1100,
    "am_interest_balance_cents": 0,
    "deferred_interest_balance_cents": 200,
    "am_deferred_interest_balance_cents": 0,
    "total_interest_paid_to_date_cents": -16
  },
  "merchant_data": {
    "name": "string",
    "id": "string",
    "mcc_code": 42.0,
    "phone_number": "string"
  },
  "issuer_processor_details": {
    "lithic": {
      "last_four": 3324,
      "transaction_token": "33xd08bc-d100-488y-bb93-f8a1f081ff0e",
      "card_token": "c6cd08bc-c524-48f5-b64d-f79ec0810df4"
    }
  },
  "external_fields": [
    {
      "key": "Globex Card Processing Account ID",
      "value": "22445702-a389-431f-927d-07b8d0750787"
    }
  ],
  "line_item_overview": {
    "line_item_status": "VALID",
    "line_item_type": "CHARGE",
    "description": "Charge against the account"
  }
}