简体   繁体   English

Moltin Javascript问题:moltin.Cart.Complete返回406不可接受

[英]Moltin Javascript issue: moltin.Cart.Complete returns 406 not acceptable

Using the Moltin Javascript SDK and able to retrieve products and add them to my cart. 使用Moltin Javascript SDK并能够检索产品并将其添加到我的购物车中。 However when I try to checkout the cart and process a payment I get a 406 Not acceptable returned. 但是,当我尝试结帐购物车并处理付款时,我得到了406不可接受的退货。

This I have stripped out all my two way binding and used the code snippet from Moltin's site but still not result. 我已经剥离了所有两种方式的绑定,并使用了Moltin网站上的代码段,但仍然没有结果。

Link to the entire project as well https://github.com/humbm0/ecommerce-site . 链接到整个项目以及https://github.com/humbm0/ecommerce-site

Thanks in advance! 提前致谢!

angular.module('ecommerceSite2App')
.controller('CheckoutCtrl', function ($scope, checkout, moltin) {
$scope.items = checkout.cart.contents;

$scope.createOrder = function() {

  var order = moltin.Cart.Complete({
    gateway: 'dummy',
    customer: {
      first_name: 'Jon',
      last_name:  'Doe',
      email:      'jon.doe@gmail.com'
    },
    bill_to: {
      first_name: 'Jon',
      last_name:  'Doe',
      address_1:  '123 Sunny Street',
      address_2:  'Sunnycreek',
      city:       'Sunnyvale',
      county:     'California',
      country:    'US',
      postcode:   'CA94040',
      phone:      '6507123124'
    },
    ship_to: 'bill_to',
    shipping: '1305214549095350548'
  });
  console.log(order);

  var checkout = moltin.Checkout.Payment('purchase', order.id, {
    data: {
      number:       '4242424242424242',
      expiry_month: '02',
      expiry_year:  '2017',
      cvv:          '123'
    }
  });

Have you checked that you have enabled the dummy gateway from the forge dashboard? 您是否已检查是否已从伪造仪表板启用了虚拟网关? - https://forge.moltin.com/gateway -https://forge.moltin.com/gateway

The second thing, instead of using the shipping method ID could you try using the shipping method slug instead? 第二件事,您可以尝试使用运输方法段塞来代替使用运输方法ID吗?

If you need more help you can also request an invite to join our community slack channel where you can speak to other users and the rest of the moltin team. 如果您需要更多帮助,您还可以请求邀请加入我们的社区闲暇频道,在这里您可以与其他用户和moltin团队的其他成员交谈。 https://moltin.com/community https://moltin.com/community

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

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