Skip to main content
Charges

Create a charge via API

David Link avatar
Written by David Link
Updated over 3 months ago

Overview

The Charges API allows clients to proactively send billing-related data associated with specific deals in the CRM system. This enables the accurate association of charges to the correct partners and deals, ensuring efficient billing processes.

Endpoint

URL

POST https://tryeuler.bubbleapps.io/api/1.1/wf/charges

Method

POST

Request Format

To submit a charge, provide a JSON payload with the following fields:

{ 
"amount": 100,
"currency": "usd",
"chargeDate": "Sep 17, 2024, 7:29:38 PM",
"dealId": "abc123",
"transactionId": "1234324"
}

Fields

Field

Type

Required

Description

amount

Number

Yes

The amount of the charge, expressed in cents. For example, pass 100 for a charge of $1.00.

currency

String

Yes

The currency code for the charge, using three-letter ISO codes (e.g., usd for U.S. dollars). Only supported codes from ISO 4217 will be accepted.

chargeDate

Date

Yes

The date and time of the charge. Acceptable formats include ISO 8601 (e.g., "2024-09-17T19:29:38Z"), UTC date-time (e.g., "Sep 17, 2024, 7:29:38 PM"), or simple date format (e.g., "12-04-2024").

dealId

String

Yes

The unique identifier for the CRM deal. This ensures the charge is associated with the correct deal and partner.

transactionId

String

Yes

A unique identifier for the transaction. This field is required to track the transaction effectively.

Example Success Response

{ 
"status": "success",
"response": {
"id": "1729193599031x633853775301859200"
}
}

Example Error Response

{ 
"status": "success",
"response": {
"error": "The deal id abc12 was not found. Please review and use a valid deal id. If you continue encountering an error, please reach out to support for help: [email protected]"
}
}

Validation Notes

  • The amount field must be passed in cents. For instance, for $1.00, you would pass 100. This method ensures precision in monetary transactions.

  • The currency field is validated against the list of ISO 4217 currency codes. Acceptable values include standard codes like usd (United States Dollar), eur (Euro), and gbp (British Pound). Any unsupported currency codes will result in a validation error.

  • The chargeDate field accepts multiple formats for flexibility, including ISO 8601, UTC Date-Time, and simple date format. It must comply with one of these accepted formats.

By following these guidelines, you ensure that charge data is processed accurately and linked to the appropriate CRM deal.

Did this answer your question?