【问题标题】:How does Magento manage the payment for the ordered products with Paypal?Magento 如何使用 Paypal 管理订购产品的付款?
【发布时间】:2013-05-22 01:13:47
【问题描述】:

早上好!

我正在为 Magento 商店(适用于 Android)开发一个移动应用程序。我正在使用 SOAP v1,并使用一些自定义方法制作了一个自定义模块。该应用程序专注于最终客户,因此,基本上,我正在开发一个让客户从商店购买产品的应用程序。 我知道如何使用 Magento API 将产品添加到购物车以及如何下订单,但是……

创建订单时会发生什么?

call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));

假设客户必须支付他订购的产品,所以我不知道如何获取Paypal URL并在浏览器中打开它。 Paypal 通知 Magento 商店客户已支付产品费用?

我在这方面有点迷茫。
我认为 API 文档没有解释这部分。

谢谢!

【问题讨论】:

  • 我也在尝试这样做。我正在考虑使用当前的 Paypal SDK 进行整个付款,并以某种方式通过 SOAP 将付款 ID 发送到服务器以完成订单,但我不知道这是否可行。考虑到您提出这个问题以来的时间,也许您已经找到了解决方案,是吗?
  • 我没有找到任何解决方案,抱歉。 Magento 文档真的很烂。我被困在那个项目中,所以现在我没有工作。无论如何,如果你找到任何方法让它工作,如果你能与我联系,我将非常感激。祝你好运!
  • 好的,无论如何感谢您的回答,请确定,如果我找到方法,我会在这里与您分享 ;-)

标签: magento soap paypal magento-1.7


【解决方案1】:

如果您使用 paypal_standard 作为付款方式。然后按照以下步骤操作。

  1. 使用支付方式作为 paypal_standard 下订单。

  2. 之后通过paypal标准sdk发起支付。

  3. 付款成功后,您可以创建自己的 api,通过它您可以使用以下代码编辑之前创建的订单。

    $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);
    

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-11
    • 2011-07-18
    • 1970-01-01
    • 2012-12-10
    • 2017-08-15
    相关资源
    最近更新 更多