1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazonの領収書問題を解決するスクリプト

Last updated at Posted at 2025-09-08

 Amazonの購入履歴から取得できる「領収書」が6月あたりから「注文の明細」となり様式がガラッと変わってしまって困っていたが、そのまま領収書として認めてもらえるか不安ながら保管していた。

この問題の解決策

 ネットを探すと、皆さん困っていたようで、スマホでは従来の領収書が出るという話もあり、そこから解決策を見つけた人の記事がありました。
「Amazonで領収書が表示・印刷できない問題が発生(2025年6月)」
https://sbapp.net/appnews/an/receipt-not-displayed-172498

自動化するスクリプトを作った

 いちいちURLを書き換えるのは面倒なので、自動化するスクリプトを書きました。
「注文概要」の表示が出たら、このスクリプトを実行すると、従来の「領収書」が表示されます。

ソースコード

 作成した AppleScript のコードは次のとおり

Amazon旧領収書表示
--  Amazonの注文履歴で「領収書」を発行する操作を行うと、「領収書」ではなく「注文概要」という
--  表題になってしまい、従来の「領収書」が発行できない問題を解決するスクリプト。
--  URLの中の /gp/css/ の間に :legacy を追加すると良いというのをネットで見つけたので、
--  それを自動化するスクリプト。
--  (注意) Safari 用になっていますので、Google Chrome で使用するには、
--  "Safari" を "Google Chrome" に、”current tab" を "active tab" にそれぞれ
--  書き換えてご利用ください。(AppleScript 対応の違いに起因)
--  Written by YNOMURA.COM
-- 
tell application "Safari"
   set urlData to URL of current tab of window 1
end tell
set tmp to text item delimiters
set text item delimiters to "/gp/"
set urlItems to text items of urlData -- URLを”/gp/" で分割
set text item delimiters to tmp

set rst to item 1 of urlItems & "/gp/legacy/" & item 2 of urlItems

tell application "Safari"
   set URL of current tab of window 1 to rst
end tell

Google Chromeで使う方法

スクリプトのソース内のコメントにも書いていますが、Safari と Google Chrome では、AppleScript の実装が違うため、
tell application "Safari" を "Google Chrome" に変える他に
current window 0 を active window 0 に変更する必要があります。

Mac以外の方

AppleScript なので、macOS 以外をお使いの方は使用できませんが、参考にしていただいて、どなたかが自動化する方法を公開してくれることを期待しています。

また仕様が変わらないか一抹の不安

 とりあえず、現時点での解決策が見つかってよかったものの、この方法がいつまで使えるのか、ちょっと不安な面もありますね。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?