1

我们正在使用 Paypal Pro 进行直接信用卡处理。当我在请求中放入 2 笔交易时会发生什么,信用卡批准了一个交易对象,但由于资金不足而拒绝了另一个交易对象。PayPal 是否会丢弃整个交易并返回错误?

直接从 node.js 的 paypals rest api 获取以下代码

var payment_details = {
  "intent": "sale",
  "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [{
      "credit_card": {
        "type": "visa",
        "number": "4417119669820331",
        "expire_month": "11",
        "expire_year": "2018",
        "cvv2": "874",
        "first_name": "Joe",
        "last_name": "Shopper",
        "billing_address": {
          "line1": "52 N Main ST",
          "city": "Johnstown",
          "state": "OH",
          "postal_code": "43210",
          "country_code": "US" }}}]},
  "transactions": [{
    "amount": {
      "total": "7.47",
      "currency": "USD",
      "details": {
        "subtotal": "7.41",
        "tax": "0.03",
        "shipping": "0.03"}},
    "description": "This is the payment transaction description." }]};

paypal_sdk.payment.create(payment_details, function(error, payment){
  if(error){
    console.error(error);
  } else {
    console.log(payment);
  }
});

当我们将 2 个交易对象放入其中时会发生什么情况,我们是否必须处理信用卡在第二次交易中被拒绝的情况?

4

1 回答 1

0

这就是我们最终使用的。我们使用项目字段来告诉贝宝交易中的多个项目。Items 是一个项目数组:

items.push({
    quantity: "1",
    name: classList[i].name,
    price: price.toFixed(2),
    currency: "USD"
});

var create_payment_json = {
    "intent": "sale",
    "payer": {
        "payment_method": "paypal"
    },
    "redirect_urls": {
        "return_url": "http://"+config.host+"/payment/success/"+paymentId,
        "cancel_url": "http://"+config.host+"/payment/cancel/"+paymentId
    },
    "transactions": [{
        "item_list": {
            "items": items
        },
        "amount": {
            "currency": "USD",
            "total": (total.toFixed(2))
        },
        "description": description
    }]
};
于 2014-03-27T15:31:00.773 回答