Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
336 stars 99 forks source link

Duplicated charge_id error while updating the old capped amount #202

Closed devRonak closed 3 months ago

devRonak commented 11 months ago

@Kyon147 I have recently changed my capped amount for the app, but the user who installed the app before changing the capped amount is still getting the old capped amount, so I am using this API to update it. I get "update_capped_amount_url" in the response of this API. When we go to this URL, permission is sought from the user to approve the new capped amount. When the user clicks on the approve button, the "laravel-shopify" package tries to insert a new entry in the "charges" table. But the old "charge_id" is already filed in the table of charges, it is UNIQUE, due to which the error of Duplicate entry is coming. Do you have any suggestions for this thing?

2 1

Kyon147 commented 3 months ago

Hi @devRonak

Late reply but charges do have to be unique, Shopify requires you to ask the customer to re-approve any subscription with changes. So this would need to be a new charge and removing the older one.