Retrieving a credit card expiration date after a successful order

Highlighted
New Member
2 0 0

Trying to retrieve a credit card expiration date after a successful order.  I found the rest call.

 

GET /admin/api/#{api_version}/checkouts/#{token}/payments/#{payment_id}.json

I have the api_version.  I think the checkout token is retrieved in the webhook for the order.  I cannot figure out the payment_id or where to get it.  Any help would be greatly appreciated. 

0 Likes
Shopify Staff
Shopify Staff
1555 79 242

You'll want to look at the order transaction object: https://help.shopify.com/en/api/reference/orders/transaction

 

You can lift the credit card expiry month and year from there.

 

Cheers.

0 Likes
New Member
2 0 0

That is exactly the rest call I was looking at.  What I don't know is this.

 

GET /admin/api/#{api_version}/orders/#{order_id}/transactions/#{transaction_id}.json

I know where to get the #{api_version}, I know where to get the #{order_id}, that is send through my order webhook json.  I don't know where to get #{transaction_id}. 

0 Likes
Shopify Staff
Shopify Staff
1555 79 242

You could GET /admin/api/version/orders/id/transactions.json and search for a transaction that is either a sale or capture with a success status, then lift the credit card details from there without needing to proceed to the direct URL. An alternative could be subscribing to order_transactions/create webhooks and parsing the data from those payloads as well.

 

Cheers.

0 Likes
New Member
2 0 0

While the last 4 of the credit card and credit card company are available in the payment details section of the response, I don't see credit card expiration date anywhere. Could you please confirm if this field is or is not available in the GET transaction response, where it should be if it is and reasons it would not be displayed?

0 Likes