哪一个是正确的PayPal API代码用于支付的信用卡/借记卡


Which one is correct PayPal API code to use for Payment by Credit/Debit card?

我正在研究电子商务应用程序,该应用程序要求PayPal支付网关通过信用卡/借记卡从客户那里获得付款。我已经通过开发人员网站上可用的所有PayPal API类型,但我找不到我需要的那个。谁能帮我摆脱这种混乱,哪一个是正确的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="info@companyname.com">
        <!-- 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>

我想你应该试试Paypal Express Checkout,这是更好的方式。

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

下载演示代码:https://demo.paypal.com/us/demo/download?capability=checkOutWithPaypal〈PHP

由paypal与HTML表单的经典集成如下。参考:Paypal html表单基础

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <input type="hidden" name="cmd" value="_xclick">
  <input type="hidden" name="business" value="seller@designerfotos.com">
  <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侦听器更新服务器上的付款,如paypal文档中所述