Fix error when no saved cards

This commit is contained in:
Skylar Ittner 2025-06-28 11:40:24 -06:00
parent f93632949e
commit 51f7269e69

View File

@ -591,7 +591,7 @@ exports.init = function () {
// Return all saved payment methods tied to the provided customer UUID.
var methods = [];
var response = await apiRequest(`v2/cards?reference_id=${customerUUID}`, {}, "GET");
if (Object.keys(response).length == 0) {
if (Object.keys(response).length == 0 || typeof response.cards == "undefined") {
return [];
}
console.log(response);