Order REST Admin API - how get "Payment Reference" value?

Camil
Tourist
15 0 2

Hello,

On CSV orders export, I can see column called Payment Reference,  it have content

on my sample shop "#1003.1"

I read that .2 or  .1 means number of tries of payment, but this is development store and I did not make any real payment - just flag as payment  done.

#1003 looks like order name.

 

Where I can find that information?

I tried get REST  Admin - Risks but it return no value.

 

If anyone could help me out  will be great!

Regards

 

Replies 12 (12)

Gregarican
Shopify Partner
1033 86 285

I don't understand the "Payment Reference" property you are looking for. If you bring up an order in the admin web UI, you can just append .json to the end of the address your the browser address bar. For example:

https://{shop_name}.myshopify.com/admin/orders/{order_id}.json

This will show the raw JSON data for the order. If you look in there you should see payment_gateway_names, which shows the route that the payment was processed. You should also see payment_details, which contains the properties for the payment (e.g. - credit card details).

Here's an example:

"payment_gateway_names":[
         "shopify_payments"
      ]
      ...
      "payment_details":{
         "credit_card_bin":"414740",
         "avs_result_code":"Y",
         "cvv_result_code":null,
         "credit_card_number":"•••• •••• •••• 6999",
         "credit_card_company":"Visa"
      }

 

Camil
Tourist
15 0 2

Thank You  both for replying  me,

Kindly please go to following address:

https://YOUR-SHOP.myshopify.com/admin/orders?selectedView=all  

select some orders and click export.

You will be prompted with CSV file, after opening CSV file You will get something like this:

 

(bellow is RANDOM data - no GDPR infringement )

Screenshot 2020-07-06 at 18.43.17.png

 

I would like get exactly same value, in same format sufix / prefix but via Rest API (or GraphQL if required).

After making API call to orders.json  reveal that checkout_id is empty but export CSV page reveal values as on above picture.

That's why I have problem in finding this value in response.

 

 

Gregarican
Shopify Partner
1033 86 285

I see what you're getting at now. Okay, here is an export I pulled. Note the Payment Reference that's boxed in red.

export.jpg

If I go to each order_id and hit its Transactions endpoint then I can see the underlying details. Like this URL --> https://{my_shop}.myshopify.com/admin/orders/{order_id}/transactions.json

The Payment Reference field that appears in the CSV export appears here, see below boxed in red.

transactions.json.jpg

Camil
Tourist
15 0 2

Thank You for Your time, I believe You are correct, but please take look at my example.

On right You can see order  export, with  payment reference  #1003.1 on left side there is transactions array for it (You can cross compare field ID and order_id it's missing payment transactions (because this is test payment) but still it have #1003.1  id  filled in CSV?

Screenshot 2020-07-06 at 19.38.10.png

Gregarican
Shopify Partner
1033 86 285

I see what you are saying...so what happens when you hit https://{your_shop}.myshopify.com/admin/orders/2535983415450/transactions.json? The one field I had boxed in red should have its property value as #1003.1, right? If that's what you need then that is how you get it!

Camil
Tourist
15 0 2

This is reply I get:

{   "transactions": [      {         "id": 3172471308442,
         "order_id": 2535983415450,
         "kind": "sale",
         "gateway": "manual",
         "status": "success",
         "message": "Marked the manual payment as received",
         "created_at": "2020-07-02T11:28:41-04:00",
         "test": false,
         "authorization": null,
         "location_id": null,
         "user_id": null,
         "parent_id": null,
         "processed_at": "2020-07-02T11:28:41-04:00",
         "device_id": null,
         "receipt": {},
         "error_code": null,
         "source_name": "web",
         "amount": "0.10",
         "currency": "USD"
      }
   ]
}

 

So the red box item is missing there 😕

Gregarican
Shopify Partner
1033 86 285

I'd suspect this was because it was a manual/test transaction. When the shop is connected with a payment gateway and whatnot in production I'd imagine that the Transactions endpoint would indeed provide you with what you are looking for. If anyone else would like to chime in as well to confirm 🙂  

Camil
Tourist
15 0 2

Thank You, If I confirm - I will post update here.

If on CSV export there would be empty field than it will be easy to understand, but now they put value that we can't find:)

DSNDev
Tourist
3 0 2

Hi Greg, do you mind showing what you did to get the charges metadata section to appear in your api call?

We have run it like your example and do not see this area.

 

Maybe older grandfathered Shopify Stores have richer data 

Gregarican
Shopify Partner
1033 86 285

I don't recall anything special. Just hitting the API endpoint and looking at the response body. Then in the Shopify web admin I would pull up a specific order, and just append .json to the URL to view the raw data. The only thing I remember is that perhaps test transactions that didn't hit a real payment gateway wouldn't have all of the data properties that a real transaction would...

DSNDev
Tourist
3 0 2

In the end, it is impossible after the fact to update a transaction in Authorize.net with the proper Shopify Receipt.  The only real solution is for Shopify to admit they have it wrong and fix it.  It would take seconds to fix. I can't believe all of their users just tolerate this.

Jonathan-HA
Shopify Partner
316 24 99

Hey Camil,

In the REST Order API, this is basically the checkout_id field but without the "c" prefix and the ".x" suffix.

Co-Founder / Developer at Highview Apps
Our Shopify Apps: EZ Exporter | EZ Inventory | EZ Importer | EZ Notify | EZ Fulfill