简体   繁体   English

Magento 2 REST API 如何使用管理员或集成令牌代表客户创建订单

[英]Magento 2 REST API how to create an order on behalf of customer with Admin or integration token

In our integration with Magento we need to create an order for a customer (not a guest) without the customer token.在与 Magento 的集成中,我们需要在没有客户令牌的情况下为客户(而非客人)创建订单。 We're hoping that it is possible using Admin or Integration token.我们希望可以使用 Admin 或 Integration 令牌。 Every thing works fine up to the point the order needs to be created by posting the payment information.一切正常,直到需要通过发布付款信息来创建订单为止。 We only see APIs to do it with customer token (/carts/mine/payment-information) or for guest customer (/guest-carts/{cartId}/payment-information).我们只看到使用客户令牌 (/carts/mine/payment-information) 或访客客户 (/guest-carts/{cartId}/payment-information) 的 API。

Does this means it is not possible to create an order on behalf of a customer using an Admin or Integration token?这是否意味着无法使用管理员或集成令牌代表客户创建订单?

Thank you!谢谢!

To apply a payment method, you should be able to use the carts/{cartId}/selected-payment-method API. Note that the cartId is the actual int id and not the masked id.要应用付款方式,您应该能够使用carts/{cartId}/selected-payment-method API。请注意, cartId是实际的 int id 而不是屏蔽的 id。

Example PUT payload for {{magentoProtocol}}://{{magentoDomain}}/rest/default/V1/carts/:cartId/selected-payment-method {{magentoProtocol}}://{{magentoDomain}}/rest/default/V1/carts/:cartId/selected-payment-method示例PUT负载

{
    "method": {
        "method": "stripe_payments",
        "additional_data": {
            "cc_stripejs_token": "{{stripePaymentToken}}",
            "cc_save": false
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM