我使用paypal rest api payments资源来更新付款的金额和项目信息;我只想更改项目的价格和税金;以及运费金额;但返回MALFORMED_REQUEST;让我喝醉……
request_data为:
{
"op": "replace",
"path": "/transactions/0/item_list/items/0",
"value": {
"name": "hello",
"quantity": "2",
"price": "100",
"currency": "USD",
"tax": "12"
}
},
{
"op": "replace",
"path": "/transactions/0/amount",
"value": {
"currency": "USD",
"total": "224",
"details": {
"shipping": "12",
"subtotal": "200",
"tax": "12"
}
}
}
返回:{"name":"MALFORMED_REQUEST","message":"MALFORMED_REQUEST","information_link":"https://developer.paypal.com/docs/api/#MALFORMED_REQUEST","debug_id":"78c05f9b4f21"}
我想要确保:
1、可以使用paypal更新支付的项目信息
2、是"/transactions/0/item_list/items/0“的正确路径
非常感谢!
发布于 2017-06-07 00:47:56
我正在使用PayPal Java SDK,并使用以下代码更新购物车项目和总价值。
APIContext context = new APIContext(clientId,clientSecret,environment);
List<Patch> patches = new ArrayList<Patch>();
Amount amount = new Amount();
amount.setCurrency("BRL");
amount.setTotal("100.00");
Patch patch1 = new Patch();
patch1.setOp("replace").setPath("/transactions/0/amount").setValue(amount);
patches.add(patch1);
ItemList items = getItens(order);
Patch patch2 = new Patch();
patch2.setOp("replace").setPath("/transactions/0/item_list").setValue(items);
patches.add(patch2);
try {
Payment payment = Payment.get(context, id);
payment.update(context, patches);
...
} ....
https://stackoverflow.com/questions/38113797
复制相似问题