如何解决PayPal 订单创建:状态 422,尽管值匹配,但金额不匹配错误
我收到来自 paypal 的 422 import os
import cv2
import glob
path = "clean"
os.makedirs(path,exist_ok=True)
for filename in glob.glob('*.png'):
img = cv2.imread(filename)
height,width,depth = img.shape
width_cutoff = width // 2
s1 = img[:,:width_cutoff]
s2 = img[:,width_cutoff:]
number = int(filename.split(".")[0])
number2 = 2*number
number1 = number2-1
cv2.imwrite(f'{path}/{number1}.png',s1)
cv2.imwrite(f'{path}/{number2}.png',s2)
错误,表明我的 UNPROCESSABLE_ENTITY
和 amount->value
值不匹配,但据我所知它们不匹配。请求正文如下:
breakdown
错误消息说 "amount": {
"currency_code": "USD","value": 5,"breakdown": {
"item_total": {
"value": 10,"currency_code": "USD","discount": {
"value": 5,"currency_code": "USD"
}
}
}
}
:amount->value
既然我没有运输/处理/保险/等,不应该只是Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount.
吗?我在这里错过了什么?
另外,为了以防万一,我的购买单位中只有一件商品:
5(amount) = 10(item_total) - 5(discount)
解决方法
discount
位于此处的 wrong place 中:
"breakdown": {
"item_total": {
"value": 10,"currency_code": "USD","discount": {
"value": 5,"currency_code": "USD"
}
}
}
将它移出 item_total
(它作为未知字段被忽略),并移到它所属的父 breakdown
对象中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。