Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal REST API - Description/Item name missing

I am using paypal ruby sdk in order to process credit cards via rest api. Everything is working fine from perspective of credit card processing. Credit cards are processed properly without any kind of issues.

Unfortunately, when i preform the csv export of transactions on the sandbox (or live) merchant paypal account, the "Item Title" field is not populated and also I cannot see that description field is used anywhere.

Request to the paypal:

Request[post]: https://api.sandbox.paypal.com/v1/payments/payment
Request.body={
    "intent":"sale",
    "payer":{
        "payment_method":"credit_card",
        "funding_instruments":[{
            "credit_card":{
                "number":"xxxxxxxxxxxxxxxx",
                "type":"visa",
                "expire_month":10,
                "expire_year":2020,
                "first_name":"First Name",
                "last_name":"Last Name"
            }
        }]
    },
    "transactions":[{
        "amount":{
            "currency":"USD",
            "total":"1"
        },
        "description":"This is item description",
        "item_list":{
            "items":[{
                "quantity":"1",
                "name":"This is item description",
                "price":"1",
                "currency":"USD",
                "sku":"This is item description"
            }]
        }
    }]
}

Within the successful paypal response I am getting all of these data back including the fields populated with "This is item description".

My question is, which parameter we need to provide for this api call in order to populate "Item Title" field within transactions csv export?

What is the purpose of "description" field within this api request and where this field is used on paypal side (showed) after we process payment with credit card?


EDITED

Tried with PHP SDK as well (just to be sure that this is not an issue with specific SDK). At the end it seems that question is "Is there a field to be used as part of REST API which corresponds to 'Item Title' column within paypal export?"

like image 285
cool Avatar asked Jul 21 '16 15:07

cool


2 Answers

Indeed answer from pp_pduan answers on initial bounty question (related with specific report). I am adding an update related with this specific report and other reports as well.

For credit card processing you can use following API's on paypal side:

  1. Rest API
  2. DoDirect Payment Api (Pro 3.0)
  3. Payflow Gateway Api (Pro 1.5-2.0)

As per my discussion with paypal side and quite a detailed research, it is not possible to populate Item Name for some of the reports using REST API. For credit card processing (in order to avoid issues in general with reporting systems) I suggest to go with DoDirect Payment Api if you have Pro accounts. Seems that this specific API is "older" then REST API credit card processing hence it is more stable and do not have any kind of issues with reporting system.

Having in mind that DoDirect Payment Api have weird documentation (at least for me this is not covered properly) I suggest to check following php repository with working solution (examples).

like image 141
cool Avatar answered Nov 10 '22 16:11

cool


Try put a sample request payload like this,

{
  "intent": "sale",
  "payer": {
    "payment_method": "paypal"
  },
  "redirect_urls": {
    "return_url": "http://localhost:80/getpaypal",
    "cancel_url": "http://localhost:80/cancel"
  },
  "transactions": [
    {
     "description": "Transaction Desc Text",
      "amount": {  
            "total":"80",
            "currency":"USD"
      },
      "item_list": {
        "items": [
          {
            "name": "Test Ticket 1",
            "currency": "USD",
            "quantity": "1",
            "sku": "55a460ff65f13",
            "price": "10"
          },
          {
            "name": "Test Ticket 2",
            "currency": "USD",
            "quantity": "2",
            "sku": "55a460ff66c7a",
            "price": "20"
          },
          {
            "name": "Test Ticket 3",
            "currency": "USD",
            "quantity": "3",
            "sku": "55a460ff66ce2",
            "price": "10"
          }
        ]
      },
      "invoice_number": "55a460ff696br"
    }
  ]
}

And when you download transaction history (csv) from your PayPal profile,

  • If you've ticked the option "Include Shopping Cart details", enter image description here

    the "name" field under each item object will display in the "Item Title" col; and the description field in transaction object will be in that col as well

enter image description here

  • If you leave the option of "Include Shopping Cart details", the transaction will be a single record in the csv without the cart item rows, and you'll only see ""description": "Transaction Desc Text"," (description field in transaction object) in the Item Title col
like image 21
pp_pduan Avatar answered Nov 10 '22 15:11

pp_pduan