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

Highlighted
New Member
13 0 0

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

 

0 Likes
Highlighted
Shopify Partner
593 41 118

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

 

0 Likes
Highlighted

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
0 Likes
Highlighted
New Member
13 0 0

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.

 

 

0 Likes
Highlighted
Shopify Partner
593 41 118

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

0 Likes
Highlighted
New Member
13 0 0

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

0 Likes
Highlighted
Shopify Partner
593 41 118

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!

0 Likes
Highlighted
New Member
13 0 0

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 :/

0 Likes
Highlighted
Shopify Partner
593 41 118

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 :)  

0 Likes
New Member
13 0 0

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:)

0 Likes