php - PayPal Rest API - 实时支付失败,沙盒工作

标签 php rest curl paypal

我建立了一个职位列表网站,您可以在其中付费发布自己的职位列表。一切都按预期工作,甚至是工作搜索功能和用户注册/配置文件系统。一切都在现场,看起来很棒!

但现在我们已将 PayPal 切换为实时凭证,付款无法正常进行。它与 Sandbox 一起工作......我尽可能地遵循 Rest API,允许可选字段并需要必填字段,发送 API 文档中定义的正确类型格式(整数,字符串和对象)......

仍然,每个尝试付款的人都会收到“信用卡被拒绝”的通知。 我已经联系了 paypal 并反复尝试解决问题,但他们坚持认为问题还没有结束。

我还将在发送给 paypal 的电子邮件中包含以下调试信息,但也许这里有人对此类问题有更多经验,可以帮助我。

这是使用我自己的个人信用卡提交的 JSON 代码(当然,敏感信息已删除):

{"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"}]}

这是从 PayPal 收到的来自 cURL 的结果(在对象布局中):

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)

最佳答案

查看特定 debug_id 的日志后,这显示为标准付款拒绝。这不是一个集成问题。如果您需要任何更具体的信息,您需要联系客户支持并让他们查找您使用的卡的付款尝试。

关于php - PayPal Rest API - 实时支付失败,沙盒工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22310923/

相关文章:

php - 如何使用 laravel mail 和 gmail 转义 & 符号

php - 在 Guzzle 中同时模拟响应和使用历史中间件

php - Laravel 中如何获取当前查询的 DB_HOST 值

java - 为什么我在android中遇到异常

linux - curl 仅显示内容类型

php - 类别帖子数

c# - 大小超过64KB的请求无法完成(Asp.Net Core Web API)

ruby-on-rails-3 - 检查/取消选中喜欢/不喜欢喜欢/不喜欢资源的 REST 方式

json - jq select() 和 sort_by()

bash - curl 范围不起作用(下载整个文件)