Get RecurringApplicationCharge REST

Highlighted
Shopify Partner
5 0 0

Hi, 

I created a RecurringApplicationCharge (with Status: 201) and activated successfully (with Status: 200). And I can also see my app has the "recurring app charge activation" in the event column for the corresponding store.

I have been using my Node.js instance and "Advanced Rest Client Application" to test the GET request of "/admin/recurring_application_charges.json". I keep getting "{ recurring_application_charges: [] }" for the response. I also tried GET "/admin/recurring_application_charges/#{id}.json", I keep getting "{errors: "Not Found"}"

Can someone help?

Thanks!

Eric

0 Likes
Excursionist
30 0 4

Replace "#{id}" with the ID of the object?

When you created the RecurringApplicationCharge, the response you got back should have included a body consisting of a JSON payload containing an instance of the object - that payload should also contain the ID as a key/value pair.

“All America lies at the end of the wilderness road, and our past is not a dead past, but still lives in us. Our forefathers had civilization inside themselves, the wild outside. We live in the civilization they created, but within us the wilderness still lingers. What they dreamed, we live, and what they lived, we dream.” ― T.K. Whipple
0 Likes
Shopify Partner
5 0 0

Hi James,

I got that bit. I tried "/admin/recurring_application_charges/864613.json", "{errors: "Not Found"}" is what I got in the response. Not only that, even I tried to get all the RecurringApplicationCharge with "/admin/recurring_application_charges.json", I didn't receive any results (this is the response "{ recurring_application_charges: [] }" )

Eric

0 Likes
Shopify Partner
5 0 0

These are the steps I did:
1. Create a Recurring Application Charge
Request:
POST https://suguu.myshopify.com/admin/recurring_application_charges.json?access_token=479f15f679324dc7f2...

Request: Body: 
{   "recurring_application_charge": {
    "name":"Test Recurring Plan",
    "price":1,
    "return_url":"http://localhost:5001/activate";,
    "test":true,
    "trial_days":7
} }

Response:

{  recurring_application_charge: {
        activated_on: null
        api_client_id: 191981
        billing_on: null,
        cancelled_on: null
        created_at: "2014-07-28T06:17:05-04:00"
        id: 820237
        name: "Test Recurring Plan"
        price: "1"
        return_url: "http://localhost:5001/activate_charge";
        status: "pending"
        test: true
        trial_days: 7
        trial_ends_on: null
        updated_at: "2014-07-28T06:17:05-04:00"
        decorated_return_url: "http://localhost:5001/activate?charge_id=820237";
        confirmation_url: "http://suguu.myshopify.com/admin/charges/820237/confirm_recurring_application_charge?signature=BAhpA...;
} }

2. redirect user to the "http://suguu.myshopify.com/admin/charges/820237/confirm_recurring_application_charge?signature=BAhpA...;

3. click "Install App" and then click "Approve charge"

4. Activate charge:
Request:
Post: https://suguu.myshopify.com/admin/recurring_application_charges/820257/activate.json?access_token=47...

Request Body:
{ "recurring_application_charge": {
      "activated_on":"2014-07-28T10:24:22",
      "api_client_id":191981,
      "billing_on":"2014-08-04T10:24:22",
      "cancelled_on":null,
      "created_at":"2014-07-28T10:24:22",
      "id":"820257",
      "name":"Test Recurring Plan",
      "price":1.99,
      "return_url":"http://localhost:5001/activate_charge";,
      "status":"accepted",
      "test":true,
      "trial_days":7,
      "trial_ends_on":"2014-08-04T10:24:22",
      "updated_at":"2014-07-28T10:24:22",
      "decorated_return_url":"http://localhost:5001/activate?charge_id=820257";
} }

Response:
HTTP Status 200

5. Now, if I do:
GET Request:
"https://suguu.myshopify.com/admin/recurring_application_charges.json?access_token=479f15f679324dc7f2...;

Response:
{ "recurring_application_charges": [ ] }

Note: No results in the recurring_application_charges array

Is there anything I missed?

 

0 Likes
Shopify Partner
5 0 0

Hi James,

I've got that working now. Thanks for your help!

Eric

0 Likes