Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
payment_tokens.php
Go to the documentation of this file.
1 <?php
7 include "customer.php";
8 
11 
14  [
15  'customer_id' => 1,
16  'public_hash' => '1234',
17  'payment_method_code' => 'first',
18  'type' => 'simple',
19  'expires_at' => '2016-09-04 10:18:15',
20  'is_active' => 1
21  ],
22  [
23  'customer_id' => 1,
24  'public_hash' => '12345',
25  'payment_method_code' => 'second',
26  'type' => 'simple',
27  'expires_at' => '2016-10-04 10:18:15',
28  'is_active' => 1
29  ],
30  [
31  'customer_id' => 1,
32  'public_hash' => '23456',
33  'payment_method_code' => 'third',
34  'type' => 'notsimple',
35  'expires_at' => '2016-11-04 10:18:15',
36  'is_active' => 1
37  ],
38  [
39  'customer_id' => 1,
40  'public_hash' => '234567',
41  'payment_method_code' => 'fourth',
42  'type' => 'simple',
43  'expires_at' => '2016-12-04 10:18:15',
44  'is_active' => 0
45  ],
46 ];
48 foreach ($paymentTokens as $tokenData) {
50  $paymentToken = $objectManager->create(PaymentToken::class);
52  ->setData($tokenData)
53  ->save();
54 }
$objectManager
$paymentTokens