<?php
$secret_key = 'sk_test_51PrGD1DatwCeUkw2FqfjBmMxhMA9WC2WqeCAwXbBlspKzr4qkC3G701EX3nKkasvn5mFdpGORSYFUjq33tdy0CDT00xRD99Rcs' ;
// Set up the cURL request
curl_setopt ( $ch , CURLOPT_URL
, "https://a...content-available-to-author-only...e.com/v1/subscriptions/sub_1Q3xakDatwCeUkw2uY0f3SmU" ) ;
'Authorization: Bearer ' . $secretKey ,
'Content-Type: application/x-www-form-urlencoded' ,
] ) ;
// Set the parameters for the update
$postFields = [
'cancel_at_period_end' => 'true' ,
] ;
// Execute the request
// Check for errors
$responseData = false ;
// curl_error($ch);
} else {
// Decode the response
$responseData = $response ;
}
return $response_data ;
// Close the cURL session
?>
PD9waHAKJHNlY3JldF9rZXkgPSAnc2tfdGVzdF81MVByR0QxRGF0d0NlVWt3MkZxZmpCbU14aE1BOVdDMldxZUNBd1hiQmxzcEt6cjRxa0MzRzcwMUVYM25La2Fzdm41bUZkcEdPUlNZRlVqcTMzdGR5MENEVDAweFJEOTlSY3MnOyAgCiAgICAvLyBTZXQgdXAgdGhlIGNVUkwgcmVxdWVzdCAgCiAgICAkY2ggPSBjdXJsX2luaXQoKTsgIAoKICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9VUkwsICJodHRwczovL2EuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmUuY29tL3YxL3N1YnNjcmlwdGlvbnMvc3ViXzFRM3hha0RhdHdDZVVrdzJ1WTBmM1NtVSIpOyAgCiAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfUkVUVVJOVFJBTlNGRVIsIHRydWUpOyAgCiAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfUE9TVCwgdHJ1ZSk7IAoKICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9IVFRQSEVBREVSLCBbICAKICAgICAgICAnQXV0aG9yaXphdGlvbjogQmVhcmVyICcgLiAkc2VjcmV0S2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