当前位置: 首页 > 知识库问答 >
问题:

如何从新的Paypal同步Api获取销售ID

夏侯自珍
2023-03-14

我正在使用新的Paypal同步Api来获取一段时间内的所有交易。我也需要能够退款。由于我们所有的交易总是销售,我需要销售ID来退款交易,正如https://developer.paypal.com/docs/integration/direct/payments/recharnet-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保存在数据库中?

谢谢

共有1个答案

易和怡
2023-03-14

对于T0006您很幸运,它是一个简单的PayPal签出API.事务,对于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":{ 

         }
      },
 类似资料:
  • 我正在使用PHP中的PayPal API来创建交易,既可以使用信用卡,也可以通过PayPal本身。此外,我需要能够退款这些交易。我使用的代码(大部分是直接来自PayPal API示例)对于信用卡交易很好,但对于PayPal交易却失败了。具体地说,我正在尝试通过Payment对象向下钻取该销售的ID。通过信用卡支付的对象包含一个RelatedResources对象,该对象又包含带有ID的Sale对象

  • 我正在使用PayPal的REST SDK for Java:https://github.com/paypal/paypal-java-sdk 首先,我使用方法获取支付的详细信息。 然后,要执行退款,我需要销售ID。因此,我通过以下调用从前一步中检索的对象中检索此内容: 对于这两个列表,是否有方法确保列表中的元素是与您相关的元素?在什么情况下,返回的列表中有多个元素? 谢谢

  • {“ID”:“Pay-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,“Create_Time”:“2016-06-20T11:45:28Z”,“Update_Time”:“2016-06-20T11:45:28Z”,“State”:“Created”,“Intent”:“Sale”,“Payment_Method”:“Credit_

  • 我正在尝试将PayPal REST API集成到我的Symfony2 web应用程序中,但我发现很难理解完整的工作流程到底是什么样子的: PayPal文档描述了以下接受付款的步骤。可以使用PayPal Playground模拟以下步骤: 获取访问令牌 通过查询API创建对象 将用户重定向到响应中接收的 用户在PayPal页面上批准支付后,将使用对象中定义的成功链接将其重定向回我的页面。使用接收到的

  • 问题内容: 是否可以从cordova-sqlite同步获取数据? 我有一个带有字段(ID,caseName,日期)的表。该表中的每一行都对应于另一个以caseName字段命名的表。我需要遍历该表并获取所引用表中的行数计数。 为了在列表视图中显示“ i”的值,我需要显示该表中有多少个元素。我需要调用同步,因为我需要调用一些查询,该查询计算该元素中“ result.rows.item(i).CaseN

  • 我想知道如何从贝宝API v2获取交易ID。 我已经通过PayPal API v2创建了一个订单(https://developer.paypal.com/docs/api/orders/v2/)并成功地捕获了它。订单的状态为“已完成”,订单已出现在我的PayPal沙箱帐户中的活动中,如我所料。现在我想获取捕获事务的事务ID(见图),但我无法获取它。 我通过PayPalAPI获得订单的详细信息,但