PayPal REST API Payment::get 不返回电话

Posted

技术标签:

【中文标题】PayPal REST API Payment::get 不返回电话【英文标题】:PayPal REST API Payment::get doesn't return Phone 【发布时间】:2015-07-18 07:40:17 【问题描述】:

基本上,我正在创建一个订单管理系统,并且需要检索“付款人”电话号码。然而,在 JSON 响应中没有... paypal 根本不返回这个吗?我设置用来测试的沙盒买家账户有两个电话号码记录在案。然而他们在发出 Payment::get() 请求时没有返回电话号码。


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

【问题讨论】:

【参考方案1】:

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

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

一旦你打开它,你也应该得到电话号码,如下所示:


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

【讨论】:

嗨@Eshan。请问沙盒账号和开发者账号是什么关系?我认为我们需要的是开发者的帐户,因为客户端和秘密 ID 位于那里而不是沙盒帐户中?

以上是关于PayPal REST API Payment::get 不返回电话的主要内容,如果未能解决你的问题,请参考以下文章

PayPal REST API 未返回 payment_info

PayPal REST API Payment::get 不返回电话

如何将 PayPal Classic Payment 表单转换为 PayPal REST API PHP 应用程序?

Paypal Payment REST API Web 体验配置文件

如何使用rest api将paypal Single Payment集成到移动应用程序中

PayPal Rest API 创建付款不返回销售 ID