Billing API - Does the recurring charge turn active automatically?

Solved
Shopify Partner
40 0 1

Hi, all Experts

 

# What I have done

(1) Create recurring charge API

(2) App(User) request for billing and get the param of confirmationUrl and redirect user to confirm the payment page

(3) User approval the payment

(4) Show the list of recurring charge on app

 

# My question

According the doc, when (3) user approval the payment, the charge status should be the "accepted" then I have to active that charge to make it paid . But the result I query from the list of recurring charge. The latest one charge's status is always "active".

I think that the charge become active after user approval is good.
Because I don't have to hook the accept behavior and then call active charge API by myself.

But I want to confirm that does Shopify let the recurring charge to be "active" after user approval? I only use test mode to simulate the approval of payment. The result always return the charge to be "active".

 

Thanks to help.

0 Likes
Shopify Staff
Shopify Staff
1014 67 134

Hi @kcin1993 , 

 

You do in fact need to activate a recurring application charge after the user accepts it - the flow is outlined in this doc

 

If you're seeing charges that you've created as 'active', they must have been activated by your app at some point. If you have an example of one of these charges, I could take a look at our logs to confirm for you if you could provide me the ID (it would need to have been created/activated within the past 12 days).

0 Likes
Highlighted
Shopify Partner
40 0 1

@Josh 

Thanks for reply. I will check my code again.

 

Because we need the charged Id to activate the charge. I there any way to make it automatically(in our code)?

I mean that when store owner accept the charge. How do we know there is a charge accepted by store owner and we have to activate the charge from the certain charge_id?

 

Thanks

0 Likes
Shopify Partner
40 0 1

@Josh 

The ID:6294601824 
In our code I think I only create the charge and paid it in test mode. 

Here is the response for our demo store.

      {
        "id": 6294601824,
        "name": "JIOUKOU Basic",
        "api_client_id": 2941547,
        "price": "24.00",
        "status": "active",
        "return_url": "http://shopify-app-production.yosgo.com/setting",
        "billing_on": "2019-08-14",
        "created_at": "2019-08-14T01:11:20-04:00",
        "updated_at": "2019-08-14T01:11:51-04:00",
        "test": true,
        "activated_on": "2019-08-14",
        "cancelled_on": null,
        "trial_days": 0,
        "trial_ends_on": "2019-08-14",
        "decorated_return_url": "http://shopify-app-production.yosgo.com/setting?charge_id=6294601824"
      }
0 Likes

Success.

Shopify Staff
Shopify Staff
1014 67 134

Hey again @kcin1993 , 

 

Yes, your charge was created in test mode. There's no way to automatically have a real recurring charge activate itself, you'll have to do it yourself. 

 

When a user accepts a charge, they'll be sent to the return_url that you set when creating the recurring charge initially. So when users are sent to your return_url, you can look up the charge and make sure that its status is 'accepted' and then activate it by following step 3 here.

0 Likes
Shopify Partner
40 0 1

@Josh 

 

That is clear.

I might create a new page for the return_url. Trigger the activate charge on that page.

0 Likes