简体   繁体   中英

PayPal Rest API - Live payments fail, sandbox works

I've built a job listing website where you can pay to publish your own job listings. Everything is working as expected, even the job searching functionality and user registration/profile system. It's all live and looks great!

But now that we've switched PayPal over to the live credentials, payment is not working. It was working with the Sandbox... I have followed the Rest API as closely as possible, allowing optional fields and requiring the required ones, sending the proper type formats (integer, strings and objects) as defined in the API documentation...

Still, everyone who attempts payment gets a notification of the "Credit card was refused". I have contacted paypal and have been through much back-and-forth trying to resolve the issue, but they persist that the issue is not on their end.

I'm going to include the debugging information below in an email to paypal as well, but maybe someone here has some more experience with this type of issue and can help me out.

Here is the JSON code submitted using my own personal credit card (sensitive info removed, of course):

{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"**hidden**","type":"mastercard","expire_month":10,"expire_year":2016,"cvv2":"**hidden**","first_name":"Radley","last_name":"Sustaire","billing_address":{"line1":"**removed**","city":"Veneta","postal_code":"97487","country_code":"US","state":"OR"}}}]},"transactions":[{"amount":{"total":"1.00","currency":"USD"},"description":"Purchased product: 30-Day Free Job Listing"}]}

And here is the result received from PayPal, from cURL (in object layout):

Submitted information (CC Details masked):
array(3) {
  ["intent"]=>
  string(4) "sale"
  ["payer"]=>
  array(2) {
    ["payment_method"]=>
    string(11) "credit_card"
    ["funding_instruments"]=>
    array(1) {
      [0]=>
      array(1) {
        ["credit_card"]=>
        array(8) {
          ["number"]=>
          string(10) "**removed**"
          ["type"]=>
          string(10) "mastercard"
          ["expire_month"]=>
          int(10)
          ["expire_year"]=>
          int(2016)
          ["cvv2"]=>
          string(10) "**removed**"
          ["first_name"]=>
          string(6) "Radley"
          ["last_name"]=>
          string(8) "Sustaire"
          ["billing_address"]=>
          array(5) {
            ["line1"]=>
            string(15) "**removed**"
            ["city"]=>
            string(6) "Veneta"
            ["postal_code"]=>
            string(5) "97487"
            ["country_code"]=>
            string(2) "US"
            ["state"]=>
            string(2) "OR"
          }
        }
      }
    }
  }
  ["transactions"]=>
  array(1) {
    [0]=>
    array(2) {
      ["amount"]=>
      array(2) {
        ["total"]=>
        string(4) "1.00"
        ["currency"]=>
        string(3) "USD"
      }
      ["description"]=>
      string(42) "Purchased product: 30-Day Free Job Listing"
    }
  }
}

---
Submitted information (JSON):
string(482) "{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"**removed**","type":"mastercard","expire_month":10,"expire_year":2016,"cvv2":"**removed**","first_name":"Radley","last_name":"Sustaire","billing_address":{"line1":"**removed**","city":"Veneta","postal_code":"97487","country_code":"US","state":"OR"}}}]},"transactions":[{"amount":{"total":"1.00","currency":"USD"},"description":"Purchased product: 30-Day Free Job Listing"}]}"
---
cURL Headers:
array(6) {
  ["CURLOPT_POST"]=>
  bool(true)
  ["CURLOPT_SSL_VERIFYPEER"]=>
  bool(false)
  ["CURLOPT_HEADER"]=>
  bool(false)
  ["CURLOPT_RETURNTRANSFER"]=>
  bool(true)
  ["CURLOPT_HTTPHEADER"]=>
  array(3) {
    [0]=>
    string(65) "Authorization: Bearer **removed**"
    [1]=>
    string(24) "Accept: application/json"
    [2]=>
    string(30) "Content-Type: application/json"
  }
  ["CURLOPT_POSTFIELDS"]=>
  array(1) {
    [0]=>
    string(484) "{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"**removed**","type":"mastercard","expire_month":10,"expire_year":2016,"cvv2":"**removed**","first_name":"Radley","last_name":"Sustaire","billing_address":{"line1":"**removed**","city":"Veneta","postal_code":"97487","country_code":"US","state":"OR"}}}]},"transactions":[{"amount":{"total":"1.00","currency":"USD"},"description":"Purchased product: 30-Day Free Job Listing"}]}"
  }
}

---
Paypal Response (raw):
string(191) "{"name":"CREDIT_CARD_REFUSED","message":"Credit card was refused","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#CREDIT_CARD_REFUSED","debug_id":"ab5d7c220fd22"}"

---
Paypal Response (Object):
object(stdClass)#385 (4) {
  ["name"]=>
  string(19) "CREDIT_CARD_REFUSED"
  ["message"]=>
  string(23) "Credit card was refused"
  ["information_link"]=>
  string(76) "https://developer.paypal.com/webapps/developer/docs/api/#CREDIT_CARD_REFUSED"
  ["debug_id"]=>
  string(13) "ab5d7c220fd22"
}

---
HTTP Info:
array(23) {
  ["url"]=>
  string(42) "https://api.paypal.com/v1/payments/payment"
  ["content_type"]=>
  string(16) "application/json"
  ["http_code"]=>
  int(400)
  ["header_size"]=>
  int(495)
  ["request_size"]=>
  int(687)
  ["filetime"]=>
  int(-1)
  ["ssl_verify_result"]=>
  int(0)
  ["redirect_count"]=>
  int(0)
  ["total_time"]=>
  float(5.217304)
  ["namelookup_time"]=>
  float(2.1E-5)
  ["connect_time"]=>
  float(0.088343)
  ["pretransfer_time"]=>
  float(0.367546)
  ["size_upload"]=>
  float(481)
  ["size_download"]=>
  float(191)
  ["speed_download"]=>
  float(36)
  ["speed_upload"]=>
  float(92)
  ["download_content_length"]=>
  float(-1)
  ["upload_content_length"]=>
  float(0)
  ["starttransfer_time"]=>
  float(5.216257)
  ["redirect_time"]=>
  float(0)
  ["certinfo"]=>
  array(0) {
  }
  ["primary_ip"]=>
  string(11) "**removed*"
  ["redirect_url"]=>
  string(0) ""
}

---
cURL Error #: int(0)

After looking at the logs for that specific debug_id, this is showing as a standard payment decline. It's not an integration issue. If you need any more specific information, you'll need to contact Customer Support and have them look up the payment attempts for your card you used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM