How Can I Associate Charges and Orders With Subscriptions?
Question
The CHARGE_LINE_ITEM
and ORDER_LINE_ITEM
tables don't contain subscription_id
columns. How can I associate charges and orders with subscriptions?
Environment
Connector: Recharge
Answer
You can use the purchase_item_type
and purchase_item_id
columns to associate orders and charges with subscriptions.
The purchase_item_type
column defines whether the record is associated with a one-time purchase or a subscription, and the purchase_item_id
column contains the ID associated with the purchase. Therefore, you can associate orders and charges with subscriptions by viewing records where purchase_item_type=subscription
and matching the corresponding purchase_item_id
values.