Magento如何通过Paypal管理订购产品的付款?
早上好 我正在为一家Magento商店(Android)开发一款移动应用程序。我使用的是soapv1,我用一些自定义方法创建了一个自定义模块。该应用程序主要针对最终客户,因此,基本上,我正在开发一个应用程序,让客户从商店购买产品。 我知道如何使用MagentoAPI将产品添加到购物车,以及如何下订单,但是 创建订单时会发生什么情况?Magento如何通过Paypal管理订购产品的付款?,magento,soap,paypal,magento-1.7,Magento,Soap,Paypal,Magento 1.7,早上好 我正在为一家Magento商店(Android)开发一款移动应用程序。我使用的是soapv1,我用一些自定义方法创建了一个自定义模块。该应用程序主要针对最终客户,因此,基本上,我正在开发一个应用程序,让客户从商店购买产品。 我知道如何使用MagentoAPI将产品添加到购物车,以及如何下订单,但是 创建订单时会发生什么情况? call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation
call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
假设客户必须支付他订购的产品,所以我不知道如何获取Paypal URL并在浏览器中打开它Paypal通知Magento商店客户支付了产品费用?
call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
我在这方面有点迷路了。我认为API文档没有解释这一部分
谢谢 如果您使用paypal_标准作为您的付款方式。然后按照以下步骤操作
$appEmulation = Mage::getSingleton("core/app_emulation");
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
$order = Mage::getModel("sales/order")->loadByIncrementId($incrementId);
$payment = $order->getPayment();
$payment->setTransactionId($confirm->response->id)
->setPreparedMessage("status : ".$confirm->response->state)
->setShouldCloseParentTransaction(true)
->setIsTransactionClosed(0)
->registerCaptureNotification($order->getGrandTotal());
$order->save();
if($status == 0){
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING)
->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING)
->save();
}
else{
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED)
->setStatus(Mage_Sales_Model_Order::STATE_CANCELED)
->save();
}
if($order->canInvoice()){
$invoice = Mage::getModel("sales/service_order", $order)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
$transactionSave = Mage::getModel("core/resource_transaction")
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
}
$comment = "status :".$confirm->response->state."<br>";
$comment .= "transaction id :".$confirm->response->id."<br>";
$comment .= "date :".$confirm->response->create_time."<br>";
$comment .= "from :".$confirm->client->product_name."<br>";
$order->setIsCustomerNotified(false);
$order->addStatusHistoryComment($comment);
$order->save();
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
$appEmulation=Mage::getSingleton(“核心/应用程序仿真”);
$initialEnvironmentInfo=$appEmulation->startEnvironmentEmulation($storeId);
$order=Mage::getModel(“销售/订单”)->loadByIncrementId($incrementId);
$payment=$order->getPayment();
$payment->setTransactionId($confirm->response->id)
->setPreparedMessage(“状态:”.$confirm->response->state)
->setShouldCloseParentTransaction(true)
->setIsTransactionClosed(0)
->registerCaptureNotification($order->getGrandTotal());
$order->save();
如果($status==0){
$order->setState(Mage\u Sales\u Model\u order::STATE\u PROCESSING)
->设置状态(图像、销售、模型、订单::状态、处理)
->save();
}
否则{
$order->setState(Mage\u Sales\u Model\u order::STATE\u cancelled)
->设置状态(图像、销售、型号、订单::状态、已取消)
->save();
}
如果($order->canInvoice()){
$invoice=Mage::getModel(“销售/服务订单”,$order)->prepareInvoice();
$invoice->setRequestedCaptureCase(图像\销售\模型\订单\发票::在线捕获);
$invoice->register();
$transactionSave=Mage::getModel(“核心/资源_事务”)
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
}
$comment=“status:”$confirm->response->state。“
”;
$comment.=“事务id:”$confirm->response->id.“
”;
$comment.=“日期:”$confirm->response->create_time.“
”;
$comment.=“发件人:”$confirm->client->product_name.“
”;
$order->setIsCustomerNotified(false);
$order->addStatusHistoryComment($comment);
$order->save();
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
我也试着这么做。我正在考虑使用当前的Paypal SDK来完成整个支付,并通过SOAP将支付ID发送到服务器以完成订单,但我不知道这是否可行。考虑到你问这个问题的时间,也许你已经找到了解决办法,是吗?对不起,我还没有找到任何解决办法。Magento文档真的很糟糕。我被困在那个项目里了,所以现在我不做了。不管怎样,如果你能找到办法让它工作,如果你能与我联系,我将非常感激。祝你好运好的,谢谢你的回答,请确保如果我找到一种方法,我会在这里与你分享;-)