php - Paypal 分期付款计划的自定义变量

标签 php html paypal

我已决定使用 Paypal 的支付网关方法,该方法允许我的客户选择全额支付金额或采用分期付款计划来支付他们订购的商品。

我知道您可以在创建分期付款计划按钮之前定义变量。但是,这样做的问题是变量是预定义的。 enter image description here

我正在寻找的是,如果有一种方法可以更改这些变量的值,我该怎么做?

到目前为止,这是我的购物车页面代码。

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YQUKWHZVR23K8">
<table> 
<tr><td><input type="hidden" name="on0" value="plan"></td></tr>

<tr><td><input type="hidden" name="os0" value ="option_0"></td><td>

<strong>Installment for Programme</strong></td></tr>

<tr><td></td><td>Number of payments 4</td></tr><tr><td></td><td>Start 
payments At checkout</td></tr>
<tr><td></td><td>

<table>
<tr><th align="left">Due*</th><th align="right">Amount</th></tr>
<tr><td>At checkout</td><td align="right"><?php echo ($totalAmount/4) + 
"SGD" ; ?></td></tr><tr><td>Every 1 month (x 3)</td><td align="right"><?php 
echo ($totalAmount/4);?></td></tr><tr><td COLSPAN="2" ALIGN="right"><?php 
echo $totalAmount ?></td></tr></table></td></tr>
<tr><td colspan="3"><i>* We calculate payments from the date of checkout.
</i></td></tr></table>
<table><tr><td align=center><i></i></td></tr><tr><td><input type="image" 
src="https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif" 
border="0" name="submit" alt="PayPal - The safer, easier way to pay 
online!"></td></tr></table>
<img alt="" border="0" 
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" 
height="1">
</form>

我试图在 StackOverflow 上查找此问题,但他们主要询问的是全额付款而非分期付款方法。此外,我已经尝试了他们的解决方案,但无济于事。

如有任何帮助,我们将不胜感激。

最佳答案

通过分期付款,您可以选择不同的金额和不同的还款期限。请记住,只允许分期付款 4 期。 提供托管按钮的屏幕截图和非托管按钮的代码。请记住,我们建议您保护所有非托管按钮。 PayPal 开发者网站上的分期付款计划信息:

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/installment_step_1/

下面的非托管按钮代码(当前指向沙箱):

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-payment-plan">
<input type="hidden" name="business" value="youremail@email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Test Installment Plan">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="disp_tot" value="Y">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-PaymentPlanBF:btn_installment_plan_LG.gif:NonHosted">
<table>
<tr><td><input type="hidden" name="on0" value="plan"></td></tr>
<tr><td><input type="hidden" name="os0" value ="option_0"></td><td><strong>Variable Installments</strong></td></tr>
<tr><td></td><tr><td></td><td>Number of payments 4</td></tr><tr><td></td><td>
<table>
<tr><th align="left">No.</th><th align="left">Due*</th><th align="right">Amount</th></tr>
<tr><td>1</td><td>At checkout</td>
<td align="right">$50.00 USD</td></tr><tr><td>2</td><td>after 1 week</td>
<td align="right">$75.00 USD</td></tr><tr><td>3</td><td>after 2 weeks</td>
<td align="right">$85.00 USD</td></tr><tr><td>4</td><td>after 3 weeks</td>
<td align="right">$90.00 USD</td></tr><tr><td COLSPAN="3" ALIGN="right">Total   $300.00 USD</td></tr></table></td></tr>
<tr><td colspan="3"><i>* We calculate payments from the date of checkout.</i></td></tr></table>
<input type="hidden" name="option_select0" value="option_0">
<input type="hidden" name="option_select0_name" value="Variable Installments">
<input type="hidden" name="option_select0_type" value="V">
<input type="hidden" name="option_select0_a0" value="50.00">
<input type="hidden" name="option_select0_p0" value="0">
<input type="hidden" name="option_select0_t0" value="W">
<input type="hidden" name="option_select0_n0" value="1">
<input type="hidden" name="option_select0_a1" value="75.00">
<input type="hidden" name="option_select0_p1" value="1">
<input type="hidden" name="option_select0_t1" value="W">
<input type="hidden" name="option_select0_n1" value="1">
<input type="hidden" name="option_select0_a2" value="85.00">
<input type="hidden" name="option_select0_p2" value="2">
<input type="hidden" name="option_select0_t2" value="W">
<input type="hidden" name="option_select0_n2" value="1">
<input type="hidden" name="option_select0_a3" value="90.00">
<input type="hidden" name="option_select0_p3" value="3">
<input type="hidden" name="option_select0_t3" value="W">
<input type="hidden" name="option_select0_n3" value="1">
<input type="hidden" name="option_index" value="0">
<table><tr><td align=center><i>Sign up for</i></td></tr><tr><td><input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_installment_plan_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"></td></tr></table>
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

这是托管按钮的屏幕截图: enter image description here


谢谢,
詹妮弗

关于php - Paypal 分期付款计划的自定义变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48143830/

相关文章:

php - 忽略将数据导出到 php mysql 中的 csv 文件的空列

php - 在 Os x El Capitan 上安装 intl 扩展时出现写入失败错误

PHP socket_connect() 权限被拒绝

javascript - addClass() 基于另一个类的存在?

PayPal Checkout 使用默认设置的 PayPal 帐户付款

php - 用于定期付款的 PayPal 订阅按钮

php - 使用仅工作一次的 jquery 加载函数重新加载 div 以及如何传递变量

html - 为什么要在 HTML 文件上放置 XHTML 文档类型声明?那有什么作用?

php - 如何将货币 AED 转换为 USD,然后将其传递给 Paypal

html - 多个内联样式显示不正确