Fundraising/Normalized donation messages
Fundraising tech documentation is migrating to mediawiki.org. This documentation is outdated. For example, headers are no longer separate from message content since migrating off activemq.
This page documents the in-flight format for donation messages.
Incoming donations are sent between subsystems as a single packet of data, in a flat dictionary. We use JSON over the wire, and PHP arrays internally. Subscription creations and modifications, refunds, and unsubscribe requests are also sent using similar techniques, and are documented here as well.
Legacy format notice: This is the current schema for our messages. Please do not make edits here unless they reflect the existing queue consumer code. Message formats have developed over time and suffer from inconsistency and accumulated cruft, there is a message roadmap with plans to fix this.
Some data is sent in the message headers in wire format, to make it available for querying.
- Certifiably unique identifier sometimes used as the primary key for queuing and dequeuing operations. The default way to construct this ID is GATEWAY-GATEWAY_TXN_ID. If the message does not have a correlation-id, then the native queue server message ID is used instead.
- freeform name of the application which generated this message
- category of application.
- came in direct from donatewiki or a banner (payments.wikimedia.org)
- real time messages coming in via a listener service created by the payment provider
- created by the nightly reconciliation job
- message was generated within our CRM system itself, for example a hand-entered donation or refund.
- machine name where initial intake interfacing occurred.
- process identifier of the generating code
- revision level of the originating code
- unix timestamp encoding when the message was first added to a queue. This header is not updated during requeueing or other operations.
This is the most common type of donation message. They land in the "donations" queue, and are processed by the queue2civicrm consumer.
- Gateway identifier string, e.g. "paypal" or "globalcollect".
- Transaction ID string used by the gateway. Sadly, several of our processors cannot guarantee that this is a unique identifier.
- Time donation was received, in unix timestamp seconds since epoch.
- (required) Original currency of transaction. Do not use the deprecated original_currency or original_gross fields, these are too confusing. We'll introduce "settled_currency", etc., when it becomes necessary to track FOREX across processor accounts.
- (required) Total amount of transaction, in original currency.
- (optional) Fees charged by the payment processor, in original currency. If unspecified, this will be assumed zero, or calculated from gross - net if available.
- (optional) Amount after subtracting fees.
- (NOT IMPLEMENTED YET) Unix timestamp at which the transaction was settled.
- (NOT IMPLEMENTED YET) Currency code in which settlement was made.
- (NOT IMPLEMENTED YET) Total amount settled. (Should this be settled_amount? - it's usually reported after fees)
- (NOT IMPLEMENTED YET) Processor fee, in settlement currency.
- Donor's email. If unspecified, we may substitute with "email@example.com" for validation purposes. This default is stripped out again before storing to the database.
- (optional) If given in place of first/last_name, an Organization contact will be created rather than an Individual.
- Billing or mailing address country—not necessarily the same as the contribution_tracking country of web origin.
- Primary payment method, e.g. "cc". TODO: enumerate.
- Payment method details, e.g. "visa". TODO
- Raw gateway status code, if available.
- Text blob will be stored as a CiviCRM note, associated with the contact.
- TODO WAT?
- Our name for the gateway account, e.g. "default", "Euro". We support multiple accounts per processor.
- Conceptually broken, this should be renamed. It's a number internal to AZ Lockbox.
- (optional) "Organization" if you want to create an Org record in Civi. This is normally implicit, according to which name fields were filled out.
- Our best guess at the donor's preferred contact language.
- Always "0" TODO: EH?
- Mapped into the direct_mail_appeal custom field
- If a message does not contain enough information to import a donation into Civi, this property gives the ID of a message in the pending queue with the rest of the data. Currently used for AstroPay and Amazon IPN messages.
- Like completion_message_id, but for looking up missing information in payment cluster logs. Used for AstroPay and Amazon audit file messages.
Recurring PayPal donations
- PayPal-style recurring subtype. One of (subscr_signup, subscr_modify, subscr_payment, subscr_cancel, subscr_eot, subscr_failed)
- Gateway subscription ID
- "gross" for all subtypes except subscr_payment
- another name for mc_amount3
- "gross" field for subscr_payment
- Must be "1 M", meaning we charge every month.
- Number of installments. "0" means forever (default)
- Always "1"
- Cancellation timestamp
- Premium size
- Premium language
Recurring other gateway donations
- one of (day, week, month, year), or empty
- must be 1-ish
Other fields are the same as for one-time donation messages
- Refund subtype, one of (chargeback, refund)
- total charged to us
- total refunded to donor (not yet implemented)
- fee associated with refund or chargeback (may be high for chargebacks, not yet implemented)
- Gateway transaction ID of the original transaction
- Gateway transaction ID of the refund
When invalid messages are kicked out of a queue, they are copied into the "ORIG_QUEUE-damaged" queue using the following format:
- (header) error
- WmfException error code, like "INVALID_MESSAGE"
- (header) correlation-id
- Same as the original message's correlation ID
- error message
- json-encoded original message