After a user click on cancel or submit, what response will I be getting from shopify?

grandshipper
Shopify Partner
1 0 0

We are asked to implement the billing API for our application to get approved but I don't see in the documentation what happens after a user clicks on approve payment or cancel it. What response body will I get from Shopify after it redirects to the return URL? 

 

Thanks in advance.

Reply 1 (1)

Liam
Shopify Staff
2731 302 783

Hi Grandshipper,

 

When a user approves or declines the payment, they are redirected to the return_url you specified when creating the charge. The redirected request will include query parameters that give you the status of the charge.

 

For example, if the merchant approves the charge, they will be redirected to a URL similar to https://yourapp.com/your_return_url?charge_id=1234567. You can then retrieve the charge by its ID to confirm its status.

 

If the merchant declines the charge, Shopify redirects the merchant to your return_url without any query parameters.

 

Please note that the return_url does not receive a response body. The status of the charge needs to be verified by your app by making an API call to Shopify using the charge ID in the return_url.

You can use the GET /admin/api/2023-07/recurring_application_charges/{charge_id}.json endpoint to fetch a single recurring charge by its ID and confirm its status.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog