paypal - "Only single payment transaction currently supported"单笔交易

标签 paypal paypal-sandbox paypal-rest-sdk

我是 PayPal 集成的新手,我正在尝试创建第一笔付款,我通过他们的模拟器(https://devtools-paypal.com/apiexplorer/PayPalRestAPIs)向 PayPal Rest API 发送以下请求:

{
"intent": "sale",
"payer": {
    "payment_method": "paypal",
    "funding_instruments": [
        {
            "credit_card": {
                "number": "5277726581534042",
                "type": "mastercard",
                "expire_month": "9",
                "expire_year": "2018",
                "links": [
                    {
                        "targetSchema": {
                            "readonly": "true"
                        },
                        "schema": {
                            "readonly": "true"
                        }
                    }
                ]
            }
        }
    ],
    "payer_info": {
        "email": "ostan.marc.buyer@gmail.com"
    }
},
"transactions": [
    {
        "amount": {
            "currency": "USD",
            "total": "10"
        },
        "payee": {
            "email": "ostan.marc-faciliator@gmail.com"
        }
    }
],
"redirect_urls": {
    "return_url": "yandex.ru",
    "cancel_url": "google.com"
},
"links": [
    {
        "href": "http://google.com",
        "rel": "http://yandex.ru",
        "targetSchema": {
            "readonly": "true"
        },
        "schema": {
            "readonly": "true"
        }
    }
]
}

我得到的回应是:

{
"name": "VALIDATION_ERROR",
"details": [
    {
        "field": "transactions",
        "issue": "Only single payment transaction currently supported"
    }
],
"message": "Invalid request - see details",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR",
"debug_id": "08c2dc7a41f64"


我只是不知道如何让它工作..

PayPal 只是说我发送了 2 笔付款..

任何帮助将不胜感激

最佳答案

您是尝试使用银行卡还是 PayPal 钱包付款?
也就是说,您打算直接从卡中扣款,还是将用户重定向到 PayPal?
在您当前的请求中,您包括来自两个选项的数据。如果这就是 API Explorer 给您的问题,那么这可能是 API Explorer 的问题。

试试这个:

curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H 'Content-Type:application/json' \
-H 'Authorization:Bearer EEwJ6tF9x5WCIZDYzyZGaz6Khbw7raYRIBV_WxVvgmsG' \
-d '{
  "intent":"sale",
  "redirect_urls":{
    "return_url":"http://example.com/your_redirect_url/",
    "cancel_url":"http://example.com/your_cancel_url/"
  },
  "payer":{
    "payment_method":"paypal"
  },
  "transactions":[
    {
      "amount":{
        "total":"7.47",
        "currency":"USD"
      }
    }
  ]
}'

或者对于卡支付:

curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H "Content-Type:application/json" \
-H "Authorization:Bearer EEwJ6tF9x5WCIZDYzyZGaz6Khbw7raYRIBV_WxVvgmsG" \
-d '{
  "intent": "sale",
  "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [
      {
        "credit_card": {
          "number": "5500005555555559",
          "type": "mastercard",
          "expire_month": 12,
          "expire_year": 2018,
          "cvv2": 111,
          "first_name": "Joe",
          "last_name": "Shopper"
        }
      }
    ]
  },
  "transactions": [
    {
      "amount": {
        "total": "7.47",
        "currency": "USD"
      },
      "description": "This is the payment transaction description."
    }
  ]
}'

(用您自己的访问 token 替换授权 header )。

关于paypal - "Only single payment transaction currently supported"单笔交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19478257/

相关文章:

paypal - 在 Paypal IPN 交易期间存储 session 变量的机制

java - 外部 Jar 的 Play Framework 中的问题

javascript - Paypal 客户端 REST : how to notify server?

paypal - 使用 Express Checkout for Digital Goods 上线后出错

php - PayPal PHP SDK - 不返回 GET 变量 'success'

api - PayPal MassPay 和 AddressVerify : Which SDK do I use?

ios - MECL Paypal 转换为 ARC (IOS)

ruby-on-rails - 在 paypal 上使用自适应付款设置公司名称和标题图像

node.js - 如何创建 PayPal 订阅订单?

Laravel Netshel/Paypal 突然不能用,字符串转换错误