贝宝 REST API Payment::get 没有 return Phone

PayPal REST API Payment::get doesn't return Phone

基本上,我正在创建一个订单管理系统,需要检索 "Payer" phone 号码。但是在 JSON 响应中有 none... paypal 根本就没有 return 这个吗?我设置用于测试的沙盒买家帐户记录了两个 phone 号码。然而,他们 phone # 在发出 Payment::get() 请求时未被 returned。

{
"id": "PAY-5L1626419H036282VKVFYNAQ",
"create_time": "2015-05-07T15:36:34Z",
"update_time": "2015-05-07T15:36:45Z",
"state": "approved",
"intent": "sale",
"payer": {
    "payment_method": "paypal",
    "status": "VERIFIED",
    "payer_info": {
        "email": "moca66-buyer@live.com",
        "first_name": "test",
        "last_name": "buyer",
        "payer_id": "G33XSXSD68SKL",
        "shipping_address": {
            "line1": "1 Main St",
            "city": "San Jose",
            "state": "CA",
            "postal_code": "95131",
            "country_code": "US",
            "recipient_name": "test buyer"
        }
    }
},
"transactions": [
    {
        "amount": {
            "total": "12.94",
            "currency": "USD",
            "details": {
                "subtotal": "4.99",
                "tax": "0.35",
                "shipping": "7.60"
            }
        },
        "description": "Payment description",
        "invoice_number": "554b86812d73f",
        "item_list": {
            "items": [
                {
                    "name": "This item is a test for shipping calculation",
                    "price": "4.99",
                    "currency": "USD",
                    "quantity": "1"
                }
            ]
        },
        "related_resources": [
            {
                "sale": {
                    "id": "8M4317138Y452345R",
                    "create_time": "2015-05-07T15:36:34Z",
                    "update_time": "2015-05-07T15:36:45Z",
                    "amount": {
                        "total": "12.94",
                        "currency": "USD"
                    },
                    "payment_mode": "INSTANT_TRANSFER",
                    "state": "completed",
                    "protection_eligibility": "ELIGIBLE",
                    "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
                    "parent_payment": "PAY-5L1626419H036282VKVFYNAQ",
                    "transaction_fee": {
                        "value": "0.68",
                        "currency": "USD"
                    },
                    "links": [
                        {
                            "href": "https://api.sandbox.paypal.com/v1/payments/sale/8M4317138Y452345R",
                            "rel": "self",
                            "method": "GET"
                        },
                        {
                            "href": "https://api.sandbox.paypal.com/v1/payments/sale/8M4317138Y452345R/refund",
                            "rel": "refund",
                            "method": "POST"
                        },
                        {
                            "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5L1626419H036282VKVFYNAQ",
                            "rel": "parent_payment",
                            "method": "GET"
                        }
                    ]
                }
            }
        ]
    }
],
"links": [
    {
        "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5L1626419H036282VKVFYNAQ",
        "rel": "self",
        "method": "GET"
    }
]

}

您需要在卖家账户中开启phone号码设置。您可以在这里设置它:

https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments

一旦你打开它,你也应该得到 phone 号码作为响应,如下所示:

{
  "id": "PAY-43P312788Y877032MKVFZAHI",
  "create_time": "2015-05-07T16:17:33Z",
  "update_time": "2015-05-07T16:18:33Z",
  "state": "approved",
  "intent": "sale",
  "payer": {
    "payment_method": "paypal",
    "status": "VERIFIED",
    "payer_info": {
      "email": "XXXXXXXXX",
      "first_name": "XXXXXPersonal Test",
      "last_name": "Account",
      "payer_id": "XXXXXX",
      "shipping_address": {
        "line1": "593 Mill Street",
        "city": "Greenville",
        "postal_code": "29611",
        "country_code": "DE",
        "recipient_name": "Paypal Test"
      },
      "phone": "408-767-7151"
    }
  },
  "transactions": [
    {
      "amount": {
        "total": "7.47",
        "currency": "USD",
        "details": {
          "subtotal": "7.47"
        }
      },
      "description": "This is the payment transaction description.",
      "related_resources": [
        {
          "sale": {
            "id": "2J742201JN363443E",
            "create_time": "2015-05-07T16:17:33Z",
            "update_time": "2015-05-07T16:18:33Z",
            "amount": {
              "total": "7.47",
              "currency": "USD"
            },
            "payment_mode": "INSTANT_TRANSFER",
            "state": "completed",
            "protection_eligibility": "ELIGIBLE",
            "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
            "parent_payment": "PAY-43P312788Y877032MKVFZAHI",
            "transaction_fee": {
              "value": "0.52",
              "currency": "USD"
            },
            "links": [
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/2J742201JN363443E",
                "rel": "self",
                "method": "GET"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/2J742201JN363443E/refund",
                "rel": "refund",
                "method": "POST"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-43P312788Y877032MKVFZAHI",
                "rel": "parent_payment",
                "method": "GET"
              }
            ]
          }
        }
      ]
    }
  ],
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-43P312788Y877032MKVFZAHI",
      "rel": "self",
      "method": "GET"
    }
  ]
}