我目前正在尝试使用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