phppython-2.7shopifyshopify-appshopify-activemerchant

Shopify API - What is correct way to charge merchant for paid application?


I am working on Shopify API to make application shopify_python_api, Application required taking charges recurring charges after 14 days trial period. To make this work, after installation steps redirect app url to create_charge where i used

charge = shopify.RecurringApplicationCharge({
       'name': "tested 123123 123",
       'return_url': return_url,
       'test': True,
       'price': 0.02,
   })
charge.save()
pprint.pprint(charge)

as response i get recurring_application_charge(4182835270), as per Rest-Api document it should be json as response with decorated_return_url and confirmation_url.

what is the correct way to charge a merchant?


Solution

  • you're getting an object in return as per my understanding. There are to_dict(), to_json() etc. methods available with this object.

    Converting to dict:

    c = charge.to_dict()
    print c
    

    If you want to see all methods available

    print dir(charge)