Drupal Commerce API with Decoupled Drupal

54 Views Asked by At

I'm using Drupal commerce + commerce API modules in decoupled Drupal project. When doing the checkout frontend (in Angular) will call some third-party APIs and get some discounts for each order items. I need to update those discount details in Drupal DB.

I tried this with /jsonapi/checkout/{order_uuid} API like below. But this does not update anything in the DB.

{
    "data": {
        "type": "order--default",
        "id": "f22a4510-3477-42e3-9dfc-7dd5bba9d39e",
        "attributes": {
            "order_total": {
                "adjustments": [
                    {
                        "type": "promotion",
                        "label": "seasonal_promo",
                        "amount": {
                            "number": "1000.00",
                            "currency_code": "LKR",
                            "formatted": "LKR1,000.00"
                        }
                    }
                ]
            }
        }
    }
}

can I know, is this feasible to do with Commerce API without writing any custom logic?

Thank you.

0

There are 0 best solutions below