DynamoDB

billing-activity - us-east-1

Subscription

A subscription record. A new one is created with new due date after the previous one has been attempted for the first time.

Indexes

  • Primary - user_id and billing_date

  • GSI - billing_status-index - used to get subscriptions with a specific billing_status

  • GSI - subscription_id-index - used to get a subscription by id

Keys

  • user_id

  • billing_date - the subscription due date

Attributes

  • subscription_id - uuid that identifies the subscription

  • billing_amount

  • billing_status - SCHEDULED, ACHSENT, ERROR, WAIVED, COMPLETED

  • billing_period - MM/YYYY representation of the billing_date

  • created_date

  • completion_date

  • initial_run_date - the date the subscription was first attempted

  • last_run_date - the last time the subscription was attempted/updated

  • process - the process that last updated the subscription - INITIAL, RETRY, check-ach-cleared, WEBHOOK

  • updated_event

  • term

  • transaction_id - the payment confirmation id of the last collection attempt. If the subscription is completed, this is final. Otherwise the next attempt will overwrite this field.

  • usio_error - The payment error from the last attempt. From jpm or usio. Should get cleared to empty on a completed record

billing-activity-history - us-east-1

This table has exactly the same records in it as billing-activity. The only difference is that the primary key and indexes for this table are different. When a record is saved to the billing-activity table, it should get saved to this table, too. The primary index including the last_run_date rather than billing_date allows for a history per record in the billing-activity table. For this reason, the last_run_date field needs to be updated before saving the record, or it will overwrite the previous history record.

Indexes

  • Primary - user_id and last_run_date

  • GSI - subscription_id-index