【问题标题】:How to get sale ID from the new Paypal Sync Api如何从新的 Paypal Sync Api 获取销售 ID
【发布时间】:2019-11-24 05:34:26
【问题描述】:

我正在使用新的 Paypal Sync Api 来获取一段时间内的所有交易。我也需要能够退款。 由于我们所有的交易都是销售,我需要销售 ID 来退还交易,如 https://developer.paypal.com/docs/integration/direct/payments/refund-payments/#set-up-your-development-environment 中所述 不幸的是,我在交易响应中找不到任何可用作销售 ID 的内容

{
    "transaction_details": [

        {
            "transaction_info": {
                "paypal_account_id": "6EN7PS8P9DV6J",
                "transaction_id": "05P62542TL3758730",
                "transaction_event_code": "T0006",
                "transaction_initiation_date": "2019-07-04T12:49:55+0000",
                "transaction_updated_date": "2019-07-04T12:53:09+0000",
                "transaction_amount": {
                    "currency_code": "USD",
                    "value": "10.00"
                },
                "fee_amount": {
                    "currency_code": "USD",
                    "value": "-0.49"
                },
                "transaction_status": "S",
                "ending_balance": {
                    "currency_code": "USD",
                    "value": "0.00"
                },
                "available_balance": {
                    "currency_code": "USD",
                    "value": "0.00"
                },
                "protection_eligibility": "01"
            },
            "payer_info": {
                "account_id": "6EN7PS8P9DV6J",
                "email_address": "paypaltester3@test.de",
                "address_status": "Y",
                "payer_status": "Y",
                "payer_name": {
                    "given_name": "Tester Three",
                    "surname": "Tester Three",
                    "alternate_full_name": "Tester Three Tester Three"
                },
                "country_code": "DE"
            },
            "shipping_info": {
                "name": "Tester Three, Tester Three",
                "address": {
                    "line1": "Teststreet. 1",
                    "city": "SomeCity",
                    "country_code": "DE",
                    "postal_code": "23434"
                }
            },
            "cart_info": {
                "item_details": [
                    {
                        "item_quantity": "1",
                        "item_unit_price": {
                            "currency_code": "USD",
                            "value": "10.00"
                        },
                        "item_amount": {
                            "currency_code": "USD",
                            "value": "10.00"
                        },
                        "total_item_amount": {
                            "currency_code": "USD",
                            "value": "10.00"
                        }
                    }
                ]
            },
            "store_info": {},
            "auction_info": {},
            "incentive_info": {}
        }
    ],
    "account_number": "96B45RCG6AX3E",
    "start_date": "2019-07-03T00:00:00+0000",
    "end_date": "2019-07-04T16:00:00+0000",
    "last_refreshed_datetime": "2019-07-15T08:59:59+0000",
    "page": 1,
    "total_items": 15,
    "total_pages": 1,
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/reporting/transactions?start_date=2019-07-03T00%3A00%3A00Z&end_date=2019-07-04T16%3A00%3A00Z&fields=all&page_size=500&page=1",
            "rel": "self",
            "method": "GET"
        }
    ]
}

我使用 transactionId 和 invoiceId 测试了退款调用,但都返回了“INTERNAL_SERVICE_ERROR”。

在客户完成付款后,有什么方法可以通过 API 获取销售 ID,还是我必须在创建付款后将销售 ID 保存在数据库中?

谢谢

【问题讨论】:

    标签: java paypal paypal-rest-sdk


    【解决方案1】:

    使用 T0006 你很幸运,这是一个简单的PayPal Checkout APIs. 交易,使用 T0002 会更难。无论如何,没有响应有更多的数据。示例如下。 您可以在invoice_numberinvoice_id 中找到它。如果您在付款创建过程中有这些数据就好了。

    "transaction_details":[ 
          { 
             "transaction_info":{ 
                "paypal_account_id":"HHHHH",
                "transaction_id":"040404040404040",
                "transaction_event_code":"T0006",
                "transaction_initiation_date":"2019-10-31T06:21:37+0000",
                "transaction_updated_date":"2019-10-31T06:31:02+0000",
                "transaction_amount":{ 
                   "currency_code":"AUD",
                   "value":"96.90"
                },
                "fee_amount":{ 
                   "currency_code":"AUD",
                   "value":"-4.08"
                },
                "shipping_amount":{ 
                   "currency_code":"AUD",
                   "value":"17.90"
                },
                "transaction_status":"S",
                "transaction_subject":"Full License",
                "ending_balance":{ 
                   "currency_code":"AUD",
                   "value":"92.82"
                },
                "available_balance":{ 
                   "currency_code":"AUD",
                   "value":"92.82"
                },
                "invoice_id":"1110-US1",
                "protection_eligibility":"01"
             },
             "payer_info":{ 
                "account_id":"HHHHH",
                "email_address":"test@paypal.com",
                "address_status":"Y",
                "payer_status":"Y",
                "payer_name":{ 
                   "given_name":"First",
                   "surname":"Last",
                   "alternate_full_name":"First Last"
                },
                "country_code":"GB"
             },
             "shipping_info":{ 
                "name":"Shaun Smith",
                "address":{ 
                   "line1":"123, Some Road",
                   "line2":"Shop 4",
                   "city":"Melbourne",
                   "country_code":"AU",
                   "postal_code":"3185"
                }
             },
             "cart_info":{ 
                "item_details":[ 
                   { 
                      "item_name":"Full License",
                      "item_description":"Full License",
                      "item_quantity":"1",
                      "item_unit_price":{ 
                         "currency_code":"AUD",
                         "value":"79.00"
                      },
                      "item_amount":{ 
                         "currency_code":"AUD",
                         "value":"79.00"
                      },
                      "total_item_amount":{ 
                         "currency_code":"AUD",
                         "value":"79.00"
                      },
                      "invoice_number":"1110-US1"
                   }
                ]
             },
             "store_info":{ 
    
             },
             "auction_info":{ 
    
             },
             "incentive_info":{ 
    
             }
          },
    

    【讨论】:

      猜你喜欢
      • 2013-09-26
      • 2015-11-18
      • 2015-03-01
      • 2015-04-24
      • 2014-07-10
      • 1970-01-01
      • 2016-12-01
      • 1970-01-01
      • 2016-10-14
      相关资源
      最近更新 更多