I am php developer, I integrate my site with bluesnap. I want to allow user to remove their subscription. Bt I cannot pass url from curl, bt "HTTP/1.1 403 Forbidden....." arrise ?
Here is the code
$xmlToSend = ' < subscription xmlns="http://ws.plimus.com" >< /subscription ' > ';
$url = 'https://ws.bluesnap.com/services/2/subscriptions/'.$subs_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/xml'));
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlToSend);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
curl_close($ch);
how to solve this? Can I did this from another way or how to get another solution with out curl lib?
Thanks
$xmlToSend =<subscription xmlns="http://ws.plimus.com"> <subscription-id>' . $subscription_id . '</subscription-id> <status>C</status> <underlying-sku-id>' . $skuId . '</underlying-sku-id> <shopper-id>' . $shopper_id . '</shopper-id> </subscription>
;
This xml format i am using for cancelling the subscription $url = 'https://ws.bluesnap.com/services/2/subscriptions/'.$subs_id; you need to to modify the xml not the link, link is correct. please check the link here
Http error 403 error typically means - you do not have the Access roles or IP address enabled/needed to access the service - you need to reach out to support to grant relevant roles for the subscriptions you are coding for. i see that you are calling subscriptions - you need appropriate roles enabled for that call; also you may want to look into calling the cancel subscription API if you wish to cancel the subscription