# Charges

Charges are payments executed against Debt Accounts. They can run immediately or be scheduled into the future.

# Create Charge

POST https://<org-uuid>.production.tratta.io/api/v1/charges

curl https://<org-uuid>.production.tratta.io/api/v1/charges \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d debt_account_external_id="123456" \
 -d amount="700" \
 -d scheduled_at="2023-03-01" \
 -d email="example@example.com" \
 -d card[card_holder]="Card Holder" \
 -d card[card_number]="4242424242424242" \
 -d card[card_expiration_month]="12" \
 -d card[card_expiration_year]="23" \
 -d card[card_security_code]="123" 
 -X POST

# Parameters


amount required|numeric

The amount of payment.

scheduled_at optional|date|after_or_equal:today

Date when the charge should be scheduled at.

debt_account_external_id required|exists

External debt account id generated in the 3rd party application.

email optional|email

Email address of the customer.

send_email optional|boolean

Specifies whether or not to send the confirmation email to the customer.

payment_method_id required without card/ach|exists

Specifies the UUID of the existing payment method.

card json object with paramters

  • card_holder required without payment_method_id/ach
  • card_number required without payment_method_id/ach|valid card number
  • card_expiration_month required without payment_method_id/ach|numeric|between:1,12
  • card_expiration_year required without payment_method_id/ach|last 2 digits of a year
  • card_security_code optional
  • card_postal_code optional|5 digits

ach json object with parameters

  • account_holder required without payment_method_id/card

  • account_type required without payment_method_id/card|in:checking, savings

    Checking or Savings account type.

  • routing_number required without payment_method_id/card|valid routing number

  • account_number required without payment_method_id/card|min:4|max:17

  • account_zip required without payment_method_id/card|5 digits

    Specifies the Postal code of the account.

  • account_state required without payment_method_id/card

billing_address_id optional|exists

Specifies the UUID of the billing address.

billing_address json object with parameters

  • name optional|string
  • city optional|string
  • state optional|string
  • postal_code required with billing address object|5 digits
  • country optional|string
  • line1 optional|string
  • line2 optional|string
  • is_primary optional|boolean

# Other validations


  • Debt Account status must be active.
  • Charge amount must be greater than Organization's min_payment_amount Rule. Default value is $5 and lower than Debt Account's current_balance.

# Returns

A json with data property that contains created charge object.

immediate charge

When scheduled_at is not provided or it is today.

{
  "id": "b4ff53e3-3124-4690-9df0-c7613f6f5494",
  "reference_number": "3153686308",
  "payment_method_type": "card",
  "card": {
      "card_holder": "Test Holder",
      "card_number": "4242",
      "card_type": "Visa",
      "card_zip": "10001",
      "expiration_month": "12",
      "expiration_year": "23"
  },
  "payment_method": null,
  "billing_address": {
      "name": "Test Name",
      "city": "New York",
      "postal_code": "10001",
      "country": null,
      "line1": "5the Ave",
      "line2": null,
      "state": "New York"
  },
  "amount": 1000,
  "total_amount": "1000",
  "payment_date": "02/28/2023",
  "success": true,
  "fees": []
}

scheduled charge

When scheduled_at is after today.

{
  "id": "3ca1119d-5e08-4e41-8a9f-7272e755003a",
  "payment_method_type": "card",
  "payment_method": {
      "id": "839a0a09-5f51-45aa-a0e3-00261112109d",
      "type": "card",
      "card_token": {
          "card_holder": "Test Holder",
          "card_number": "4242",
          "expiration_month": "12",
          "expiration_year": "23",
          "card_type": "Visa",
          "card_zip": "10001"
      },
      "is_primary": false,
      "has_active_payment_plan": false,
      "created_at": "2023-02-28 13:21:16"
  },
  "scheduled_at": "2023-03-01",
  "successfully_charged_at": null,
  "amount": 1000
}