Skip to content
Snippets Groups Projects
Commit ce7692e2 authored by Rich's avatar Rich
Browse files

add payment_processor_id and payment_instrument_id

parent 1ec71d1f
No related branches found
No related tags found
1 merge request!726Formatting improvements and add code comments on Order API + fix broken URL
...@@ -355,13 +355,19 @@ $order = civicrm_api3('Order', 'create' $params); ...@@ -355,13 +355,19 @@ $order = civicrm_api3('Order', 'create' $params);
try { try {
// Use the Payment Processor to attempt to take the actual payment. You may // Use the Payment Processor to attempt to take the actual payment. You may
// pass in other params here, too. // pass in other params here, too.
civicrm_api3('PaymentProcessor', 'pay', ['contribution_id' => $order['id']]); civicrm_api3('PaymentProcessor', 'pay', [
'payment_processor_id' => $params['payment_processor_id'],
'contribution_id' => $order['id'],
'amount' => $params['total_amount'],
]);
// Assuming the payment was taken, record it which will mark the Contribution // Assuming the payment was taken, record it which will mark the Contribution
// as Completed and update related entities. // as Completed and update related entities.
civicrm_api3('Payment', 'create', [ civicrm_api3('Payment', 'create', [
'contribution_id' => $order['id'], 'contribution_id' => $order['id'],
'total_amount' => $params['amount'], 'total_amount' => $params['amount'],
'payment_processor_id' => $params['payment_processor_id'],
'payment_instrument_id' => $params['payment_instrument_id'],
]); ]);
} }
catch { catch {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment