【问题标题】:paypal subscription for multiple product using paypal api使用贝宝 api 订阅多个产品的贝宝
【发布时间】:2015-11-04 14:59:02
【问题描述】:

我正在尝试订阅 Paypal,但我没有收到任何与多个产品相关的演示或 sdk 相关的 Paypal 订阅。它只允许我一次插入一个产品信息。

所以不幸的是,我不得不将所有信息和价格结合到一个产品中。 这个问题有解决办法吗?

【问题讨论】:

  • 你试过 github 上的 paypal sdk 吗?
  • 我在使用 PayPal SDK 时遇到了很多问题。这是非常好的 REST API,一切都解释得很好:github.com/amirduran/duranius-paypal-rest-api-php-library
  • 您可以将多个产品/项目添加到贝宝订单。
  • 感谢@Mr.M,它将帮助我,如果您有任何关于此的脚本,请给我链接。谢谢

标签: php paypal


【解决方案1】:

this 网站上,您可以找到一个非常好的 REST API。

这里是如何制作多个项目的示例:

<?php

$paypal = new DPayPal(); //Create an object
$requestParams = array(
    'RETURNURL' => "http://yourwebsite.com", //Enter your webiste URL here
    'CANCELURL' => "http://yourwebsite.com/payment/cancelled"//URL where user will be redirected if he/she cancel the payment
);


$item = array(

    //Total order amount and currency    
    'PAYMENTREQUEST_0_AMT' => "155",//This has to be equal to sum of all items
    'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
    'PAYMENTREQUEST_0_ITEMAMT' => "155",//This has to be equal to sum of all items


    //Item 1

    'L_PAYMENTREQUEST_0_NAME0' => 'Item 1',
    'L_PAYMENTREQUEST_0_DESC0' => 'Item 1 description',
    'L_PAYMENTREQUEST_0_AMT0' => "55",
    'L_PAYMENTREQUEST_0_QTY0' => '1',

    //Item 2
    'L_PAYMENTREQUEST_0_NAME1' => 'Item 2',
    'L_PAYMENTREQUEST_0_DESC1' => 'Item 2 description',
    'L_PAYMENTREQUEST_0_AMT1' => "100",
    'L_PAYMENTREQUEST_0_QTY1' => '1',
);

//Call SetExpressCheckout
$response = $paypal->SetExpressCheckout($requestParams + $orderParams + $item);

if (is_array($response) && $response['ACK'] == 'Success') { //Request successful
    //Now we have to redirect user to the PayPal
    $token = $response['TOKEN'];

    header('Location: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . urlencode($token));
} else if (is_array($response) && $response['ACK'] == 'Failure') {
    echo "Error";
    exit;
}

【讨论】:

  • 谢谢,我如何在定期付款中实施它? CreateRecurringPaymentsProfile 。这是我使用string(506) "METHOD=CreateRecurringPaymentsProfile&amp;VERSION=64&amp;PWD={PWD}&amp;USER={USER}&amp;SIGNATURE={SIGNATURE}&amp;TOKEN={TOKEN}=bluezeal+softnet&amp;SHIPTOSTREET=kolkata&amp;SHIPTOCITY=kolkata&amp;SHIPTOSTATE=West+Bengal&amp;SHIPTOZIP=700114&amp;SHIPTOCOUNTRY=IN&amp;PROFILESTARTDATE=2011-07-01T0%3A0%3A0&amp;DESC=Test+Recurring+Payment%28%241+monthly%29&amp;BILLINGPERIOD=Month&amp;BILLINGFREQUENCY=5&amp;AMT=1&amp;CURRENCYCODE=USD&amp;IPADDRESS=::1&amp;BUTTONSOURCE=PP-ECWizard" 的请求
猜你喜欢
  • 2016-07-08
  • 2019-08-04
  • 2019-08-11
  • 2016-04-03
  • 2011-07-17
  • 2012-04-26
  • 2020-08-29
相关资源
最近更新 更多