The calls made over a network can take some time to complete. In a Rails app, you can use background jobs to process such calls and provide a spinner gif image to notify the user about the progress. The technique discussed in the article Processing Stripe Payments with a Background Worker in Rails 5 can be used in such cases.
1. Copy the spinner image to app/assets/images folder.
2. Use image_tag instead of hard-coding the image URL in src attribute of img.