如何在Codeigniter中实现paypal

时间:2013-08-05 06:19:15

标签: codeigniter paypal

我使用Codeigniter开发了一个网站,我想为我的一个应用程序添加paypal。为此我遵循了许多形式,如THIS但是当我按照所有步骤时,它给了我空白屏幕..任何人都可以告诉我,甚至建议我为Paypal提供更好的教程。提前谢谢..

1 个答案:

答案 0 :(得分:2)

use following paypal form pattern for paypal payment

//$urlpaypal = "https://www.paypal.com/cgi-bin/webscr";
//$urlpaypal = "https://www.sandbox.paypal.com/cgi-bin/webscr";//sandbox

<form method="post" name="frmPayPal" id="frmPayPal" action="<?=$urlpaypal ?>">

<input type="hidden" name="item_number" value="<?=$id?>"> 
<input type="hidden" name="rm" value="2"> 
<input type="hidden" name="business" value="<?=$businessId?>"> 
<input type="hidden" name="redirect_cmd" value="_cart"> 
<input type="hidden" name="handling_cart" value="<?=$shipprice?>">
<input type="hidden" name="cmd" value="_ext-enter" /> 
<input type='hidden' name='upload' value='1'> 
<input type="hidden" name="no_note" value="1"> 
<input type="hidden" name="lc"  value="<?php echo $lccode;?>"> 
<input type="hidden" name="bn"  value="PP-SubscriptionsBF"> 
<input type="hidden" name="image_url" value="<?=base_url()?>img/logo.jpg"> 
<input type="hidden" name="return" value="<?=base_url()?>index.php/payment/receipt/<?php echo $id;?>">
<input type="hidden" name="notify_url" value="<?=base_url()?>index.php/payment/notify"> 
<input type="hidden" name="cancel_return" value="<?=base_url()?>index.php/payment/cancle"> 
<input type="hidden" name="invoice" value="<?=base64_encode($invoiceId)?>"> 
<input type="hidden" name="currency_code" value="<?php echo $currencycode;?>">
<input type="hidden" name="src" value="1" />
<input type="hidden" name="sra" value="1" /> 
<input type="hidden" name="cs" value="0" /> 
<input type="hidden" name="custom" value="<?=$customFieldValue?>"> 
<input type="hidden" name="discount_amount_cart" value="<?=$discount_amount?>"> 
<input type="hidden" name="cc_number" value="123"> 
<input type="hidden" name="cpp_ headerback_ color" value="78f3f5"> 
<input type="hidden" name="cpp_ headerborder_color" value="78f3f5"> 
<input type="hidden" name="cpp_payflow_ color" value="78f3f5">
</form>

and js code for auto form submission in one second
<script type="text/javascript" language="javascript">
setTimeout("document.forms['frmPayPal'].submit()", 1000);
</script>