3 ways to load payments associated with order in drupal 8

So you have and order, but don't know how to get to payments that are referencing this order, there are few ways you can achieve that. First is to load it by properties

$payments = \Drupal::entityTypeManager()->getStorage('commerce_payment')->loadByProperties(['order_id' => $order->id()]);

second is to load them by order

How to load an order entity

If you wan to get some info from ORDER entity there is a method to do that.  We can do that by loading by some property or by loading order per ID

Drupal commerce how to add Payment programmatically

Payment is specific entity in drupal commerce, usually it will be added by payment gateway module through checkout flow, but if you need to make some custom payments programmatically then you can do it in a following way, first you would need to get payment gateway object, so you can fetch proper info, after that you need to fill in paraparameters for new payment creation, depending on how you

Drupal commerce how to make shipments(shipping) programmatically

Drupal commerce shipping module is complex, there are few moving parts that you need to consider when making custom changes to it. First there are shipment types which are associated with order type, this is usually done through UI, unless you also add order type programmatically.

Swapping out classes in plugins

In drupal 8 plugins are everywhere, so to get most out of them you will sometimes want to alter them. If you look at definitions of each plugin manager, you will see that all of them have something specific in their constructors, it is the line below

Drupal 8 commerce (2.x) - multi currency how to

For multi-currency in drupal 7 commerce we had it all running out of the box with drupal multicurrency modul. You had price fields per currency and rules that would solve that. There is no out of the box solution like that yet, but this module is pretty close to it.

Clear cache of particular entity

For debugging purposes I need to clear cache for particular drupal commerce order, but this can be done for any entity, just replace table name and id's in code below

 $table = 'cache_entity_commerce_order';
 $id ="776764";
 cache_clear_all($id, $table);