error activating subscriptions using REST APIs flow "buyer has not agreed to subscription error"

ShayanHasanKhan
Contributor
Contributor

Im using the paypal REST APIs to create subscriptions for my product. Im using postman to work with APIs. I have two sandbox accounts(bussiness connected with app, and personal account). im creating a product, then creating a plan, then activating a plan, after that when im creating subscription to that plan the API returns APPROVAL_PENDING status, but when im trying to activate the subscription using 'activate subscription' api and entering the correct subscription_id,it returns an error named "UNPROCESSABLE_ENTITY", "SESSION_STATE_NOT_VALID", "Buyer has not agreed to subscription". Please note that i am correctly doing all the steps and have checked all the things 10s of times. I cant seem to find the reason as to why i cant activate subscription. please help.

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

ShayanHasanKhan
Contributor
Contributor

I just found out the solution. and for those who are wondering:

no code for auto approve subscriptions on Sandbox (unless somebody created something that works and can help this scenario) but what you could do is a manual approval of few sandbox subscriptions using sandbox buyer accounts. Once the subscription is created just call the approve link returned in the API response:

href: "link"

note: basically just follow the link returned from api call of create subscription and confirm it from personal sandbox account

Then you can activate it.

View solution in original post

Login to Me Too
3 REPLIES 3
Solved

ShayanHasanKhan
Contributor
Contributor

I just found out the solution. and for those who are wondering:

no code for auto approve subscriptions on Sandbox (unless somebody created something that works and can help this scenario) but what you could do is a manual approval of few sandbox subscriptions using sandbox buyer accounts. Once the subscription is created just call the approve link returned in the API response:

href: "link"

note: basically just follow the link returned from api call of create subscription and confirm it from personal sandbox account

Then you can activate it.

Login to Me Too

subscription1
Contributor
Contributor

@ShayanHasanKhan I don't want to redirect user to PayPal via the approve URL after subscription is created but instead of activate subscription in my website only using the API. I am using this : (https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_activate) API for activate the subscription plan but i am getting error like: Buyer has not agreed to subscription.

So in this case user have to their PayPal account? if not then how we can approve the subscription of subscription plan created with user card details?

Login to Me Too

subscription1
Contributor
Contributor

I don't want to redirect user to PayPal via the approve URL after subscription is created but instead of activate subscription in my website only using the API. I am using this : (https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_activate) API for activate the subscription plan but i am getting error like: Buyer has not agreed to subscription.

So in this case user have to their PayPal account? if not then how we can approve the subscription of subscription plan created with user card details?
Thanks,

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.