diff --git a/src/index.js b/src/index.js index 93e53ff..0cb5e02 100644 --- a/src/index.js +++ b/src/index.js @@ -37,8 +37,8 @@ const create = ({ }; const checkSuccess = res => { - if (res.status !== 0) { - throw Error(res.message); + if (res.errors !== undefined && res.errors !== null) { + throw Error(res.errors[0].text); } return res; }; @@ -419,7 +419,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({order, confirmationId: json.confirmationId})); + .then(json => ({order, confirmationId: json.data.confirmationId})); }; /** @@ -443,7 +443,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({orderId: json.orderId})); + .then(json => ({orderId: json.data.orderId})); }; /**