2016-08-31 29 views
0

我正在開發電子商務應用程序,要求使用PayPal支付網關通過信用卡/借記卡從客戶那裏獲得付款。我已經通過開發者網站上的所有PayPal API類型,但是我找不到我需要的那個。任何人都可以幫助我擺脫困惑,哪一個是正確的API代碼使用。哪一個是正確的PayPal API代碼用於信用卡/借記卡付款?

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> 

     <!-- Identify your business so that you can collect the payments. --> 
     <input type="hidden" name="business" value="[email protected]"> 

     <!-- Specify a Buy Now button. --> 
     <input type="hidden" name="cmd" value="_xclick"> 

     <!-- Specify details about the item that buyers will purchase. --> 
     <input type="hidden" name="item_name" value="Camera"> 
     <input type="hidden" name="item_number" value="CAM0548"> 
     <input type="hidden" name="amount" value="2.0"> 
     <input type="hidden" name="currency_code" value="USD"> 

     <!-- Specify URLs --> 
     <input type='hidden' name='cancel_return' value='http://localhost/paypal/cancel.php'> 
     <input type='hidden' name='return' value='http://localhost/paypal/success.php'> 


     <!-- Display the payment button. --> 
     <input type="image" name="submit" border="0" 
     src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> 
     <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > 

    </form> 
+0

https://github.com/paypal/PayPal-PHP-SDK – castis

回答

1

我想你應該嘗試PayPal快速結帳,這是連擊的方式提到了你的服務器上更新付款。

觀看演示:https://demo.paypal.com/us/demo/navigation?device=desktop&page=merchantHome

下載演示代碼:https://demo.paypal.com/us/demo/download?capability=checkOutWithPaypal&lang=PHP

+0

對不起,但它要求登錄到PayPal帳戶而不是信用卡/借記卡細節。印度國家有什麼限制嗎? –

+0

@NileshChauhan,paypal快速結賬提供了兩種選擇。 –

+0

@NileshChauhan,如果有幫助,不要忘記評價。 –

1

經貝寶與html表格的經典整合如下。參考:Paypal html form basics

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    <input type="hidden" name="cmd" value="_xclick"> 
    <input type="hidden" name="business" value="[email protected]"> 
    <input type="hidden" name="item_name" value="Memorex 256MB Memory Stick"> 
    <input type="hidden" name="item_number" value="MEM32507725"> 
    <input type="hidden" name="amount" value="3"> 
    <input type="hidden" name="tax" value="1"> 
    <input type="hidden" name="quantity" value="1"> 
    <input type="hidden" name="no_note" value="1"> 
    <input type="hidden" name="currency_code" value="USD"> 

    <!-- Enable override of buyers's address stored with PayPal . --> 
    <input type="hidden" name="address_override" value="1"> 
    <!-- Set variables that override the address stored with PayPal. --> 
    <input type="hidden" name="first_name" value="John"> 
    <input type="hidden" name="last_name" value="Doe"> 
    <input type="hidden" name="address1" value="345 Lark Ave"> 
    <input type="hidden" name="city" value="San Jose"> 
    <input type="hidden" name="state" value="CA"> 
    <input type="hidden" name="zip" value="95121"> 
    <input type="hidden" name="country" value="US"> 
    <input type="image" name="submit" 
    src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" 
    alt="PayPal - The safer, easier way to pay online"> 
</form> 

和使用的IPN偵聽器,如貝寶文檔here

+0

我需要以這種形式來提項目名稱和價格?因爲在結賬過程中可能有多個項目。 在這段代碼中,他們要求創建PayPal賬戶而不是問卡號,失效日期和CVV號碼。我不希望客戶創建付款帳戶。何可以避免這種情況? –

+0

是的,你需要添加項目,可以添加多個項目。請參閱答案中的鏈接。對於結帳沒有帳戶這裏是一個有用的鏈接https://help.shopify.com/manual/payment-settings/paypal/let-customers-pay-without-account – Gandharv

相關問題