如何在 Paypal 中设置定期付款和一次性付款的混合

2024-03-19

我正在使用 Paypal REST API 来收取我的订阅费用。 我的交易包括一次性购买和定期付款的混合。一次性购买将向用户收取 X 金额,定期付款应创建定期配置文件,每年向用户收取 Y 金额。

这是我所拥有的。首先我打电话SetExpressCheckoutPayment具有以下参数:

$orderParams = array(
            'PAYMENTREQUEST_0_AMT' => "10",
            'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
            'PAYMENTREQUEST_0_ITEMAMT' => "10",
            'LOGOIMG'=>"http://mywebsite.com/a.jpg",
            "MAXAMT"=>"100",
            "NOSHIPPING"=>"1",
            "ALLOWNOTE"=>"0",
            "BRANDNAME"=>"My website",
            "GIFTRECEIPTENABLE"=>"0",
            "GIFTMESSAGEENABLE"=>"0"
            );


            $item = array(
                'L_PAYMENTREQUEST_0_NAME0' => 'Subscription',
                'L_PAYMENTREQUEST_0_DESC0' => 'Subscription bla bla bla',
                'L_PAYMENTREQUEST_0_AMT0' => "10",
                'L_PAYMENTREQUEST_0_QTY0' => '1',
            );

            $recurringPayment=array();
            $recurringPayment=array(
                "L_BILLINGTYPE0"=>"RecurringPayments",
                "L_BILLINGAGREEMENTDESCRIPTION0"=>""
            );

我在上面的代码中不知道的是如何设置定期付款的金额 Y 与一次性付款的金额 X 不同?

After SetExpressCheckoutPayment被执行了,我执行DoExpressCheckoutPayment,之后我打电话CreateRecurringPaymentsProfile具有以下参数:

$requestParams=array(
            "TOKEN"=>$token,
            "PROFILESTARTDATE"=>date("Y-m-d\TH:i:s\Z"),
            "DESC"=>"My Subscription",
            "BILLINGPERIOD"=>"Year",
            "BILLINGFREQUENCY"=>"1",
            "AMT"=>"94",
            "CURRENCYCODE"=>"GBP",
            "L_PAYMENTREQUEST_0_ITEMCATEGORY0"=>"Digital",
            "L_PAYMENTREQUEST_0_NAME0"=>"Subscription",
            "L_PAYMENTREQUEST_0_AMT0"=>"10",
            "L_PAYMENTREQUEST_0_QTY0"=>"1",
             );
             $response=$paypal->request("CreateRecurringPaymentsProfile",$requestParams);

重复配置文件已创建,但会向用户收取 X 金额,我不希望这样。

以下是回应: 来自的回应SetExpressCheckout

array (size=50)
  'TOKEN' => string 'EC-0G8072749' (length=20)
  'BILLINGAGREEMENTACCEPTEDSTATUS' => string '1' (length=1)
  'CHECKOUTSTATUS' => string 'PaymentActionNotInitiated' (length=25)
  'TIMESTAMP' => string '2014-09-23T16:57:24Z' (length=20)
  'CORRELATIONID' => string 'c0b0e1a38cd36' (length=13)
  'ACK' => string 'Success' (length=7)
  'VERSION' => string '74.0' (length=4)
  'BUILD' => string '12932421' (length=8)
  'EMAIL' => string '[email protected] /cdn-cgi/l/email-protection' (length=27)
  'PAYERID' => string 'KKBJKUR86XT8L' (length=13)
  'PAYERSTATUS' => string 'verified' (length=8)
  'FIRSTNAME' => string 'John' (length=4)
  'LASTNAME' => string 'Doe' (length=3)
  'COUNTRYCODE' => string 'GB' (length=2)
  'CURRENCYCODE' => string 'GBP' (length=3)
  'AMT' => string '94.00' (length=5)
  'ITEMAMT' => string '94.00' (length=5)
  'SHIPPINGAMT' => string '0.00' (length=4)
  'HANDLINGAMT' => string '0.00' (length=4)
  'TAXAMT' => string '0.00' (length=4)
  'INSURANCEAMT' => string '0.00' (length=4)
  'SHIPDISCAMT' => string '0.00' (length=4)
  'L_NAME0' => string 'My Subscription' (length=27)
  'L_QTY0' => string '1' (length=1)
  'L_TAXAMT0' => string '0.00' (length=4)
  'L_AMT0' => string '94.00' (length=5)
  'L_DESC0' => string 'My Subscription' (length=34)
  'L_ITEMWEIGHTVALUE0' => string '   0.00000' (length=10)
  'L_ITEMLENGTHVALUE0' => string '   0.00000' (length=10)
  'L_ITEMWIDTHVALUE0' => string '   0.00000' (length=10)
  'L_ITEMHEIGHTVALUE0' => string '   0.00000' (length=10)
  'PAYMENTREQUEST_0_CURRENCYCODE' => string 'GBP' (length=3)
  'PAYMENTREQUEST_0_AMT' => string '94.00' (length=5)
  'PAYMENTREQUEST_0_ITEMAMT' => string '94.00' (length=5)
  'PAYMENTREQUEST_0_SHIPPINGAMT' => string '0.00' (length=4)
  'PAYMENTREQUEST_0_HANDLINGAMT' => string '0.00' (length=4)
  'PAYMENTREQUEST_0_TAXAMT' => string '0.00' (length=4)
  'PAYMENTREQUEST_0_INSURANCEAMT' => string '0.00' (length=4)
  'PAYMENTREQUEST_0_SHIPDISCAMT' => string '0.00' (length=4)
  'PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED' => string 'false' (length=5)
  'L_PAYMENTREQUEST_0_NAME0' => string 'My Subscription' (length=27)
  'L_PAYMENTREQUEST_0_QTY0' => string '1' (length=1)
  'L_PAYMENTREQUEST_0_TAXAMT0' => string '0.00' (length=4)
  'L_PAYMENTREQUEST_0_AMT0' => string '94.00' (length=5)
  'L_PAYMENTREQUEST_0_DESC0' => string 'My Subscription' (length=34)
  'L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0' => string '   0.00000' (length=10)
  'L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0' => string '   0.00000' (length=10)
  'L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0' => string '   0.00000' (length=10)
  'L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0' => string '   0.00000' (length=10)
  'PAYMENTREQUESTINFO_0_ERRORCODE' => string '0' (length=1)

来自的回应GetExpressCheckoutDetails

array (size=25)
      'TOKEN' => string 'EC-0G807275JM0847749' (length=20)
      'SUCCESSPAGEREDIRECTREQUESTED' => string 'false' (length=5)
      'TIMESTAMP' => string '2014-09-23T16:57:27Z' (length=20)
      'CORRELATIONID' => string '5b9de22225c55' (length=13)
      'ACK' => string 'Success' (length=7)
      'VERSION' => string '74.0' (length=4)
      'BUILD' => string '12932421' (length=8)
      'INSURANCEOPTIONSELECTED' => string 'false' (length=5)
      'SHIPPINGOPTIONISDEFAULT' => string 'false' (length=5)
      'PAYMENTINFO_0_TRANSACTIONID' => string '1SV99367CG387745H' (length=17)
      'PAYMENTINFO_0_TRANSACTIONTYPE' => string 'expresscheckout' (length=15)
      'PAYMENTINFO_0_PAYMENTTYPE' => string 'instant' (length=7)
      'PAYMENTINFO_0_ORDERTIME' => string '2014-09-23T16:57:26Z' (length=20)
      'PAYMENTINFO_0_AMT' => string '94.00' (length=5)
      'PAYMENTINFO_0_FEEAMT' => string '3.40' (length=4)
      'PAYMENTINFO_0_TAXAMT' => string '0.00' (length=4)
      'PAYMENTINFO_0_CURRENCYCODE' => string 'GBP' (length=3)
      'PAYMENTINFO_0_PAYMENTSTATUS' => string 'Completed' (length=9)
      'PAYMENTINFO_0_PENDINGREASON' => string 'None' (length=4)
      'PAYMENTINFO_0_REASONCODE' => string 'None' (length=4)
      'PAYMENTINFO_0_PROTECTIONELIGIBILITY' => string 'Ineligible' (length=10)
      'PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE' => string 'None' (length=4)
      'PAYMENTINFO_0_SECUREMERCHANTACCOUNTID' => string 'EW93XTSE5SR4G' (length=13)
      'PAYMENTINFO_0_ERRORCODE' => string '0' (length=1)
      'PAYMENTINFO_0_ACK' => string 'Success' (length=7)

来自的回应CreateRecurringPayment

array (size=9)
      'TIMESTAMP' => string '2014-09-23T16:57:28Z' (length=20)
      'CORRELATIONID' => string 'dd1f80a935b65' (length=13)
      'ACK' => string 'Failure' (length=7)
      'VERSION' => string '74.0' (length=4)
      'BUILD' => string '12932421' (length=8)
      'L_ERRORCODE0' => string '10004' (length=5)
      'L_SHORTMESSAGE0' => string 'Cart item calculation mismatch.' (length=31)
      'L_LONGMESSAGE0' => string 'Cart item calculation mismatch. The regular non-trial billing period amount is different than the sum of the amounts for each item in the cart.' (length=143)
      'L_SEVERITYCODE0' => string 'Error' (length=5)

Thx!


您必须在“CreateRecurringPaymentsProfile” API 中指定的循环金额,您在“SetExpressCheckoutPayment”和“DoExpressCheckoutPayment”中设置的金额为一次性付款。

因此,经常性金额始终需要在“CreateRecurringPaymentsProfile”API 中传递。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Paypal 中设置定期付款和一次性付款的混合 的相关文章

  • 从 FilterControllerEvent 监听器重定向到另一个 Symfony 路由

    我正在尝试设置一个 kernel controller 侦听器 以便在函数返回 true 时重定向到另一个路由 我有可用的路线 但无法使用此路线设置控制器 event gt setController 我收到以下错误 FilterContr
  • php表格:每行显示3个单元格[重复]

    这个问题在这里已经有答案了 我看这里 数组放入每行 5 个单元格的表格中 https stackoverflow com questions 9099568 array into a table with 5 cells in each r
  • session_regenerate_id 没有创建新的会话 id

    我有一个脚本 旨在完成当前会话并开始新的会话 我使用了一段代码 它在我的开发计算机上运行良好 但是 当我将其发布到生产服务器时 会话 ID 始终保持不变 以下是我重新启动会话的代码 session start SESSION array P
  • 具有动态表单名称的 form_widget

    在我的 Twig 模板中 我有一个 FOR 循环 它创建多个表单 如下所示 for thing in things set form id myform thing Id set form name attribute form myfor
  • 运行 Composer 返回:“无法打开输入文件:composer.phar”

    我是 symfony2 和阅读新手symblog http tutorial symblog co uk tutorial parts 在第三章中 在尝试使用数据装置时 我尝试了以下命令 php composer phar update 但
  • 使用 PHP 将值插入可编辑 PDF,并保持可编辑状态

    我有一个带有可编辑字段的 PDF 我希望将 HTML 表单中的值传递到此 PDF 中 我尝试过使用 FPDF 并且它有效 但是将值传递到 PDF 后 pdf 中的字段不再可编辑 另一个缺点是 在将值传递到 PDF 时 我们必须为每个字段指定
  • php - 我应该加密电子邮件地址吗?

    当用户注册时 我应该将他们的电子邮件按原样存储在数据库中还是对其进行哈希处理 我希望稍后能够解密 那么我应该使用 md5 吗 谢谢你 No md5 is 单向哈希函数 http en wikipedia org wiki Cryptogra
  • 将函数中的会话变量传递给 codeigniter 中的助手

    这就是我正在尝试做的事情 这是控制器中的功能 public function get started if test login this gt session gt all userdata this gt load gt view te
  • Composer 用于下载私有 GitHub 存储库

    我无法使用 Composer 下载 github 私人存储库 php composer phar update 我收到以下错误 The https api github com repos company private1 https ap
  • PHP 中的 Preg_replace

    我想替换 中包含的字符串中的内容content 它是多行等 preg replace 函数应该删除整个 com 没有垫子 蒙特 尝试这个 result preg replace s replacement content subject
  • 如何将 mysql 转换为 mysqli? [复制]

    这个问题在这里已经有答案了 我厌倦了将 mysql 转换为 mysqli 但似乎收到了很多错误和警告 连接到数据库没有问题 但其余代码似乎错误 我做错了什么 sql
  • Laravel 按动态 ID 数组对集合进行排序 [重复]

    这个问题在这里已经有答案了 我有以下 people array 5 2 9 6 11 people collection People find people 但当我倾倒并死去时 people collection集合按 ID ASC 排序
  • Android GCM 服务器的 API 密钥

    我有点困惑我应该为 GCM 服务器使用哪个 API 密钥 在文档中它说使用 android api 密钥 这对我不起作用并且总是给出未经授权的 http developer android com google gcm gs html ht
  • 未捕获的异常“Google_IO_Exception”,消息为“HTTP 错误:无法连接”

    我有一个任务 查询 运行一些从 gmail 邮箱检索数据的 php 代码 直到上周五 2015 年 4 月 10 日 它一直工作正常 现在我收到以下错误日志 E 11 58 26 094 2015 04 15 200 3 38 KB 14
  • 在 Woocommerce 购物车中设置最小小计金额

    我正在尝试将最低订单金额设置为 25 美元 到目前为止 我找到了这段代码 如果未达到最低限度 它似乎可以阻止结账 但它使用的小计包含税费 我需要在总计中排除税费 add action woocommerce checkout process
  • 使用 DOJO 自动完成文本框

    我正在寻找一种使用 DOJO 进行文本框自动建议的简单方法 我将查询的数据库表 使用 PHP 脚本 以 JSON 形式返回 有超过 100 000 条记录 因此这确实不应该采用 FilteringSelect 或 ComboBox 的形式
  • postgreSQL 在 WAMP 上的集成

    我刚刚在 Windows 7 上安装了 postgreSQL 我正在尝试将 postgreSQL 与 WAMP 服务器集成 为此 我在 httpd conf 和 php ini 文件中进行了以下更改 1个加载模块c path to libp
  • 将数组拆分为特定数量的块

    我知道array chunk 允许将数组拆分为多个块 但块的数量根据元素的数量而变化 我需要的是始终将数组拆分为特定数量的数组 例如 4 个数组 以下代码将数组分为 3 个块 两个块各有 2 个元素 1 个块有 1 个元素 我想要的是将数组
  • 如何从字符串中删除所有数字?

    我想删除字符串 0 9 中的所有数字 我写了这段有效的代码 words preg replace 0 words remove numbers words preg replace 1 words remove numbers words
  • 文件修改时间检查的成本

    对于Linux下包含少量字节的文件 我只需要处理自上次处理以来发生更改的时间 我通过调用 PHP 检查文件是否被更改clearstatcache filemtime 定期 由于整个文件总是很小 因此删除对 filemtime 的调用并通过将

随机推荐