不同商品 不同必填字段 php,必填字段缺失。 PHP Paypal REST API

用户在使用PHP PayPal REST API时遇到一个问题,当尝试通过交易传递项目列表时收到'VALIDATION_ERROR',指出缺少'transactions[0].item_list.items[0].sku'这一必填字段。在注释掉设置项目列表的代码后,交易能够正常进行。用户寻求帮助以解决这一商品信息缺失的问题。
摘要由CSDN通过智能技术生成

我目前正在尝试使用PHP PayPal REST API。但是,似乎我无法通过交易传递项目列表,因为“缺少必填字段”。必填字段缺失。 PHP Paypal REST API

$item = new Item();

$item->setQuantity("1");

$item->setName("stuff");

$item->setPrice("305.00");

$item->setCurrency("USD");

$amount = new Amount();

$amount->setCurrency("USD");

$amount->setTotal("305.00");

$item_list = new ItemList();

$item_list->setItems(array($item));

$transaction = new Transaction();

$transaction->setAmount($amount);

$transaction->setDescription("This is incredibly awesome.");

$transaction->setItem_list($item_list);

例外:GOT HTTP响应代码400访问 https://api.sandbox.paypal.com/v1/payments/payment的时候,但我当我尝试重定向到贝宝开始交易我被抛出此错误。字符串(269) “{”name“:”VALIDATION_ERROR“,”details“:[{”field“:”transactions [0] .item_list.items [0] .sku“,”issue“:”Required field missing “}],” 消息 “:” 无效的请求 - 见 细节 “ ”information_link“:” https://developer.paypal.com/docs/api/#VALIDATION_ERROR “ ”debug_id“: ”9e292fc3a312d“}”

当我注释掉$交易 - > setItem_list( $ item_list);它工作正常。所以很明显,项目列表或项目中缺少某些内容。但我看不到什么。

任何想法?

2013-04-18

Sefam

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值