我刚刚从网壳(https://github.com/net-shell/laravel-paypal)中为Laravel实现了PayPal API,并且目前为止一切正常,但现在有一件事我遗失或者我不知道如何做:在我的门户网站,用户必须注册他们的地址。我想要的是,这封电子邮件(用于在我的门户网站注册)用作邮寄地址,稍后在贝宝网站上显示(因此无论用户输入的是什么地址)。Laravel PayPal - 通过网站传递航运地址
有没有办法做到这一点?
我知道似乎有一个PayPal:ShippingAdress,我可以使用,但如果这是正确的,那么我如何将它分配给付款呢?
编辑:我现在尝试多种变化形式的东西,如$transaction->setShippingAddress();
或$payer->setShippingAddress();
或$payment->setShippingAddress();
但没有任何工程,该方法没有找到。现在贝宝/原料药/ ShippingAddress我找到了方法setDefaultAddress,所以我想到了创建这样一个对象,并使用此方法像这样:
$shippingAddress = [
"recipient_name" => "John Johnson",
"line1" => "Whatever street 2",
"line2" => "Another street 2",
"city" => "London",
"country_code" => "UK",
"postal_code" => "NR30 1LY",
"state" => "England",
"phone" => "3123123123"
];
$shippingAddr = PayPal::ShippingAddresss();
$shippingAddr->setDefaultAddress($shippingAddress);
使用此代码没有得到一个错误,而且它没有设置地址,我需要将现在创建的shippingAddress对象分配给付款或交易,就像我使用细节创建details对象,然后使用$amount->setDetails($details);
,但我没有找到shippingAddress的任何内容.....
编辑2: 通过项目列表获取提示,这是我如何创建和设置该列表:
$itemList = PayPal::itemList();
foreach ($items as $item)
$product = Product::where('id', '=', $item->product->id)->first();
$itemName = $product->name;
$itemPrice = $product->price;
$itemAmount = $item->amount;
$payPalItem = PayPal::item();
$payPalItem->setName($itemName)
->setDescription($itemName)
->setCurrency('EUR')
->setQuantity($itemAmount)
->setPrice($itemPrice);
$itemList->addItem($payPalItem);
}
然后
$transaction = PayPal::Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
没有想法任何人? – nameless
只需要为您提供一点信息,当您通过Paypal销售商品时,如果您没有将商品寄送到其账户的地址,则您没有卖家保护。仅供参考 – Kaboom
与我同样的问题。我不推荐老兄。我以前用过5.2。有效。但是,我无法通过地址。我试图遵循PayPal文档,但没有任何可以预先加载在PayPal结帐页面。客户需要再次键入他们的地址详情和电话号码作为客人结帐。我还没有测试这个API https://github.com/anouarabdsslm/laravel-paypalpayment。但是,它看起来像更多的文件。 –