Solved

Confirm declined recurring charge

dmogil
Shopify Partner
10 0 1

Sometimes store owner can decline the application charge, instead of accepting it.

As I understand from the Shopify docs, charge can be re-confirmed using confirmation link. Here https://shopify.dev/api/admin/rest/reference/billing/recurringapplicationcharge#show-2021-01 , in the example response I see "confirmation_url" field. 

But when I'm trying to get declined charge info, "confirmation_url" field is MISSING in the response object! What should I do with this? How can get charge confirmation link and provide it in the app?

Accepted Solution (1)

SteveTT
Shopify Partner
39 4 16

This is an accepted solution.

I don't think the charge can be "re-confirmed"...

I believe the flow is this:

  1. create (POST) a recurring application charge
    • you should set "return_url" in the payload
    • I think the response from creating this also includes "decorated_return_url" that shows the exact url (see step 3) that shopify will redirect back to you, if the merchant accepts.
    • at this stage, the list (GET) of recurring application charges will have the latest one that is status: "pending"
    • the merchant has neither confirmed or declined the charge at this stage
  2. redirect to "confirmation_url" that you got in the response from step 1
    • this is shopify's url
    • IF the merchant accepts or declines, it's out of your control at this point
  3. IF the merchant accepts, shopify will redirect back to your app at "return_url", (specifically "decorated_return_url", but please check yourself,  see step 1, my own docs are a bit sketchy)
    • there will be a "charge_id" in the request. This is the id of the recurring application charge in question
    • at this stage, the list of recurring application charges will have that charge_id with status: "active"
  4. if the merchant declines, I think shopify will redirect back to the TOP level of Apps (not your app)
    • if you ever check,  the list of recurring application charges will have that charge_id with status: "declined"
  5. if the merchant neither accepts or declines, I think the list of recurring application charges will stick around "forever" and I don't think they can be "cleaned up"

Hope this helps! If it does, show some love!

View solution in original post

Replies 4 (4)

SteveTT
Shopify Partner
39 4 16

This is an accepted solution.

I don't think the charge can be "re-confirmed"...

I believe the flow is this:

  1. create (POST) a recurring application charge
    • you should set "return_url" in the payload
    • I think the response from creating this also includes "decorated_return_url" that shows the exact url (see step 3) that shopify will redirect back to you, if the merchant accepts.
    • at this stage, the list (GET) of recurring application charges will have the latest one that is status: "pending"
    • the merchant has neither confirmed or declined the charge at this stage
  2. redirect to "confirmation_url" that you got in the response from step 1
    • this is shopify's url
    • IF the merchant accepts or declines, it's out of your control at this point
  3. IF the merchant accepts, shopify will redirect back to your app at "return_url", (specifically "decorated_return_url", but please check yourself,  see step 1, my own docs are a bit sketchy)
    • there will be a "charge_id" in the request. This is the id of the recurring application charge in question
    • at this stage, the list of recurring application charges will have that charge_id with status: "active"
  4. if the merchant declines, I think shopify will redirect back to the TOP level of Apps (not your app)
    • if you ever check,  the list of recurring application charges will have that charge_id with status: "declined"
  5. if the merchant neither accepts or declines, I think the list of recurring application charges will stick around "forever" and I don't think they can be "cleaned up"

Hope this helps! If it does, show some love!

Darius90
Shopify Partner
34 0 9

@SteveTT Thank you for your answer. I was trying to create app and got stuck in this situation when client declined payment but instead of redirecting to all apps it was redirecting back to my app... Not sure where is the problem...

...
SteveTT
Shopify Partner
39 4 16

It's been a while since I looked at this but ... I think that's the behaviour I discovered too (see step 4)

Ishaaan
Shopify Partner
9 0 5

Hi SteveTT,

 

Thanks for step-by-step explanation. Was stuck in the shopify docs for the same.
I also have another query regarding the renewals(monthly). How do you handle that.

 

Can i assume if after the expiration date(Calculated at app end using billing_on and Subscription duration as shopify doesn't provide it), the charge status is still active then Merchant has renewed the subscription?

 

Regards