Skip to content

Commit

Permalink
feat(payments): google play purchases
Browse files Browse the repository at this point in the history
Veridy google play purchases
  • Loading branch information
srennen committed Aug 24, 2021
1 parent 2caefda commit 0d9001b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/components/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ export async function verifyAppStoreSubscription({
customerId,
planId,
receipt,
originalOrderId,
}) {
const response = await server.loadJson(
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.SUBSCRIPTIONS.VERIFY_APP_STORE}`,
Expand All @@ -483,7 +482,33 @@ export async function verifyAppStoreSubscription({
customerId,
planId,
receipt,
originalOrderId,
}),
}
);

return response;
}

export async function verifyPlayStoreSubscription({
secretKey,
customerId,
planId,
receipt,
}) {
const response = await server.loadJson(
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.SUBSCRIPTIONS.VERIFY_PLAY_STORE}`,
{
method: 'POST',
headers: {
'X-CM-ProjectId': Config.projectId,
Authorization: `Bearer ${secretKey || Config.secretKey}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
customerId,
planId,
receipt,
}),
}
);
Expand Down
1 change: 1 addition & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const CONFIG = {
CREATE: (customerId) =>
`/v2/payments/customers/${customerId}/subscriptions`,
VERIFY_APP_STORE: '/v2/payments/customers/subscriptions/apple',
VERIFY_PLAY_STORE: '/v2/payments/customers/subscriptions/google',
UPDATE: (customerId, id) =>
`/v2/payments/customers/${customerId}/subscriptions/${id}`,
CHANGE: (customerId, id) =>
Expand Down

0 comments on commit 0d9001b

Please sign in to comment.