Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
order_payment_list.php
Go to the documentation of this file.
1 <?php
8 
9 require 'order.php';
13  [
14  'parent_id' => $order->getId(),
15  'cc_exp_month' => '06',
16  'cc_ss_start_year' => '2014',
17  'method' => 'checkmo',
18  'cc_last_4' => '123'
19  ],
20  [
21  'parent_id' => $order->getId(),
22  'cc_exp_month' => '07',
23  'cc_ss_start_year' => '2014',
24  'method' => 'checkmo',
25  'cc_last_4' => '456'
26  ],
27  [
28  'parent_id' => $order->getId(),
29  'cc_exp_month' => '08',
30  'cc_ss_start_year' => '2015',
31  'method' => 'checkmo'
32  ],
33  [
34  'parent_id' => $order->getId(),
35  'cc_exp_month' => '09',
36  'cc_ss_start_year' => '2016',
37  'method' => 'paypal_express'
38  ],
39 ];
40 
42 foreach ($payments as $paymentData) {
45  \Magento\Sales\Model\Order\Payment::class
46  );
47  $payment
48  ->setData($paymentData)
49  ->save();
50 }
$order
Definition: order.php:55
$payment
Definition: order.php:17