Define return parameters for doPayment
See #135 (closed), https://github.com/civicrm/civicrm-core/pull/18150 and https://github.com/civicrm/civicrm-core/pull/18178
We need to clearly define what the return parameters for doPayment()
should be as it's important, it's unclear and it's not defined anywhere.
My proposal:
-
doPayment($params)
returns an array. - It must contain:
-
payment_status_id
: (deprecated) Numeric value ofContribution Status
option value Completed or Pending. Eg. 1. Must be set but make sure you setpayment_status
as well because this value will be ignored in the future. -
payment_status
: Text field - EitherCompleted
orPending
.
-
- It may contain (and the code that calls
doPayment()
will update these values on the contribution/payment:-
trxn_id
: The transaction ID from the payment processor. This will be recorded in theContribution.trxn_id
field and thePayment.trxn_id
field. We do not returnorder_reference
here because that is usually filled in by an IPN callback from the payment processor if required. -
fee_amount
: The amount (in same currency as contribution) of the fee taken by the payment processor for processing the payment.
-
Historically $params
was passed by reference. This is deprecated and only the return values should be used.
Ping @eileen @artfulrobot @KarinG
Edited by mattwire