I’m integrating an online game with my shopify store: I would like to allow a customer to purchase digital goods for the game on the store.
To do this I would have to be able to run a script, when a customer makes a purchase, and call my server to give the player said items/currency (I was thinking of using their email to match accounts).
Is this possible with Shopify? - ideally on the basic plan?
you can modify what gets loaded at the order status/success page. You can access the contents of your cart via the checkout object and run your own JS there.
For only online store methods, theme customization or admin settings(additional scripts), You will NOT be able to modify customer or order information after the fact when an order completes.
This means no clear and secure redemption tracking process without using the apis.
If you do only need to post to another site remember to hash information and not use only email address for verification as this leads to hackable redemption systems when users learn to just change the email in the requests.
There are apps like usemechanic that let you script automations against the shopify and can talk to other services with varying success depending on authentication schemes.
@r8r , Is the additional script exposed to the customer? It looks like it is, in which case is not usable since I would need server secret keys. I would need a customer-hidden script to run.
Also, checkout does not mean on successful purchase right? I would ideally want to fulfill the line items as well so don’t think this is feasible.
@PaulNewton Ok, if there is no secure way to do this only online I will use API’s: Is the only solution to host my own server to regularly query the order API for new orders and fulfill them? No way to get shopify to dynamically alert my server on a purchase or something?
I’m also probably going to avoid using the Unity SDK since I can’t integrate it with my game without exposing things I don’t want to to the client and I can just use the standard in-app purchase systems for that instead with just URL links from the game for store items if needed.
Notifications or Webhooks, The closest thing is setting up your server to receive an email then setting up a custom fulfillment service but that is one way shopify > external.
@Mowtine – yes, that would be a script you load from the frontend. It could also be blocked by the client. @PaulNewton has given some pointers about how to approach this via API endpoints, which – on closer consideration – would definitely be the more secure way to approach this task.