FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bazaar-api-php/examples/unsubscribe.php at master · nikapps/bazaar-api-php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
nikapps
/
bazaar-api-php
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bazaar-api-php
/
examples
/
unsubscribe.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (20 loc) · 819 Bytes
Breadcrumbs
bazaar-api-php
/
examples
/
unsubscribe.php
Copy path
File metadata and controls
26 lines (20 loc) · 819 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
use
Nikapps
\
BazaarApi
\
Bazaar
;
use
Nikapps
\
BazaarApi
\
Config
;
use
Nikapps
\
BazaarApi
\
Storage
\
FileTokenStorage
;
require_once
__DIR__
.
'
/../vendor/autoload.php
'
;
// We need a file to store access token. keep it in private!
$
bazaar
=
new
Bazaar
(
new
Config
([
'
client-secret
'
=>
'
your-client-secret
'
,
'
client-id
'
=>
'
your-client-id
'
,
'
refresh-token
'
=>
'
refresh-token-123456
'
,
'
storage
'
=>
new
FileTokenStorage
(
__DIR__
.
'
/token.json
'
)
]));
// Which subscription do you want to unsubscribe/cancel?
// it also automatically refreshes token if needed
$
unsubscribe
=
$
bazaar
->
unsubscribe
(
'
com.example.app
'
,
'
subscription-id (sku)
'
,
'
purchase-token
'
);
if
(
$
unsubscribe
->
successful
()) {
echo
"
The subscription has been successfully cancelled!
"
;
}
else
{
echo
$
unsubscribe
->
errorDescription
();
}
Back
|
FazBrowse Home
|
New Git URL