Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi,
I am currently trying to use the Recurring Application Charges API.
I am following the guide. I managed to create a charge and to be redirected to the merchant page where he has to accept or deny the charge.
Once I accept the charge, the return_route is called with the charge_id passed to this route. Thing is, I can't do anything with this id.
When I call the
https://{current_user.shopify_shop}/admin/recurring_application_charges/{application_charge_id}/activate.json
endpoint to have information about this particular charge_id all I get is this response:
{'errors': 'Not Found'}
Has anyone an idea about what's going on? By reading the forum I found some people talking about using the same session to do both requests but that does not fix it.
Thanks in advance.
Solved! Go to the solution
This is an accepted solution.
Hey Kevin,
I can't presently replicate this issue, My flow is as follows using shopify_python_api:
1. Instantiate session
2. Activate session
3. Instantiate RecurringApplicationCharge object, assign attributes
4. Save charge object, redirect to confirmation_url
5. After charge is activated, I get the charge object by the ID (either when I save it for later from the creation response or I take the charge_id query parameter on the return_url)
6. Activate the charge
No 404s throughout the above, so unsure what might be going wrong for you. I was using ShopifyAPI version 4.0.0 and Python 2.7.10. Pseudocode:
import shopify token = "whatever your access token is" session = shopify.Session("your-shop.myshopify.com", token) shopify.ShopifyResource.activate_session(session) rac = shopify.RecurringApplicationCharge() rac.name = "Test charge" rac.price = 10.00 rac.return_url = "https://domain.com/activate_charge" rac.capped_amount = 100.00 rac.terms = "Foobarbaz" if rac.save(): print rac.attributes # After confirmation... rac = shopify.RecurringApplicationCharge.find(3925606422) rac.activate() print rac.attributes
Cheers.
Alex | 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 the Shopify Help Center or the Shopify Blog
This is an accepted solution.
Hey Kevin,
I can't presently replicate this issue, My flow is as follows using shopify_python_api:
1. Instantiate session
2. Activate session
3. Instantiate RecurringApplicationCharge object, assign attributes
4. Save charge object, redirect to confirmation_url
5. After charge is activated, I get the charge object by the ID (either when I save it for later from the creation response or I take the charge_id query parameter on the return_url)
6. Activate the charge
No 404s throughout the above, so unsure what might be going wrong for you. I was using ShopifyAPI version 4.0.0 and Python 2.7.10. Pseudocode:
import shopify token = "whatever your access token is" session = shopify.Session("your-shop.myshopify.com", token) shopify.ShopifyResource.activate_session(session) rac = shopify.RecurringApplicationCharge() rac.name = "Test charge" rac.price = 10.00 rac.return_url = "https://domain.com/activate_charge" rac.capped_amount = 100.00 rac.terms = "Foobarbaz" if rac.save(): print rac.attributes # After confirmation... rac = shopify.RecurringApplicationCharge.find(3925606422) rac.activate() print rac.attributes
Cheers.
Alex | 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 the Shopify Help Center or the Shopify Blog
Thank you very much I was finally able to make it work with the Shopify Phyton API.
I was previously making the request from scratch.
Im having a hard time understanding the confirmation part and how to test it. I've been using Postman for testing, but can't seem to get recurring payments to work using your method.
Im using Python 3.8 with Shopify api 2020-10 and Lambda.