Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validateReceiptIos #239

Merged
merged 2 commits into from
Aug 18, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,10 @@ export const validateReceiptIos = async (receiptBody, isTest) => {
if (!response.ok) {
throw Object.assign(new Error(response.statusText), { statusCode: response.status })
}

return response.json();
};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dooboolab it seems like the merge commit removed the return value, submitting a PR for this soon 👌


/**
* Validate receipt for ios.
* Validate receipt for android.
* @param {string} packageName package name of your app.
* @param {string} productId product id for your in app product.
* @param {string} productToken token for your purchase.
Expand Down Expand Up @@ -205,6 +203,40 @@ export const validateReceiptAndroid = async (packageName, productId, productToke
}
};

/**
* deprecagted codes
*/
/*
export const validateReceiptIos = async (receiptBody, isTest) => {
if (Platform.OS === 'ios') {
const URL = isTest ? 'https://sandbox.itunes.apple.com/verifyReceipt' : 'https://buy.itunes.apple.com/verifyReceipt';
try {
let res = await fetch(URL, {
method: 'POST',
headers: new Headers({
'Accept': 'application/json',
'Content-Type': 'application/json',
}),
body: JSON.stringify(receiptBody),
});

if (res) {
const json = await res.text();
res = JSON.parse(json);
return res;
}

return false;
} catch (err) {
console.log(err);
return false;
}
}

return response.json();
};
*/

export default {
prepare,
endConnection,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.