This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
Receiving an duplicate content error when displaying billing declined in an embedded app #94
Labels
bug
Bug with the code
When displaying within an embedded app it will redirect which will cause the billing controller to try and create the charge more than once in the db. This causes an error like
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1234567890' for key 'charges_charge_id_unique'
https://github.com/ohmybrew/laravel-shopify/blob/4258693b3eb7430d426530faf1932cf70d1aa6cd/src/ShopifyApp/Traits/BillingControllerTrait.php#L51-L55
These lines could be changed to:
This will prevent the error and will select the charge rather than creating a new one.
https://github.com/ohmybrew/laravel-shopify/blob/4258693b3eb7430d426530faf1932cf70d1aa6cd/src/ShopifyApp/Traits/BillingControllerTrait.php#L83-L84
This could then become:
The text was updated successfully, but these errors were encountered: