File tree Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,34 @@ export async function createSubscription({
413413 return response ;
414414}
415415
416+ export async function createAppStoreSubscription ( {
417+ secretKey,
418+ customerId,
419+ planId,
420+ receipt,
421+ } ) {
422+ const response = await server . loadJson (
423+ `${
424+ Config . apiUrl
425+ } ${ Endpoints . PROJECT . PAYMENTS . SUBSCRIPTIONS . CREATE_APP_STORE ( customerId ) } `,
426+ {
427+ method : 'POST' ,
428+ headers : {
429+ 'X-CM-ProjectId' : Config . projectId ,
430+ Authorization : `Bearer ${ secretKey || Config . secretKey } ` ,
431+ Accept : 'application/json' ,
432+ 'Content-Type' : 'application/json' ,
433+ } ,
434+ body : JSON . stringify ( {
435+ planId,
436+ receipt,
437+ } ) ,
438+ }
439+ ) ;
440+
441+ return response ;
442+ }
443+
416444export async function updateSubscription ( {
417445 secretKey,
418446 id,
Original file line number Diff line number Diff line change @@ -157,11 +157,7 @@ export async function updateDevice({
157157 return response ;
158158}
159159
160- export async function updateDeviceUser ( {
161- secretKey,
162- idOrKey,
163- userId,
164- } ) {
160+ export async function updateDeviceUser ( { secretKey, idOrKey, userId} ) {
165161 const response = await server . loadJson (
166162 `${ Config . apiUrl } ${ Endpoints . PROJECT . NOTIFICATIONS . PUSH . UPDATE_DEVICE_USER (
167163 idOrKey
@@ -175,7 +171,7 @@ export async function updateDeviceUser({
175171 'Content-Type' : 'application/json' ,
176172 } ,
177173 body : JSON . stringify ( {
178- userId
174+ userId,
179175 } ) ,
180176 }
181177 ) ;
Original file line number Diff line number Diff line change @@ -148,6 +148,8 @@ export const CONFIG = {
148148 SUBSCRIPTIONS : {
149149 CREATE : ( customerId ) =>
150150 `/v2/payments/customers/${ customerId } /subscriptions` ,
151+ CREATE_APP_STORE : ( customerId ) =>
152+ `/v2/payments/customers/${ customerId } /subscriptions/apple` ,
151153 UPDATE : ( customerId , id ) =>
152154 `/v2/payments/customers/${ customerId } /subscriptions/${ id } ` ,
153155 CHANGE : ( customerId , id ) =>
You can’t perform that action at this time.
0 commit comments