Automation of setting up subscriptions and related content for local development (Sandbox)

drivewitherik
Contributor
Contributor

I'm trying to figure out how to automate setting up subscriptions (and related) for local development.

 

I'm able to create a subscription using the REST API, but because the buyer didn't go through the web flow, I can't activate it:

 

 

{"name":"UNPROCESSABLE_ENTITY","message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"1f3c69a6f7771","details":[{"issue":"SESSION_STATE_NOT_VALID","description":"Buyer has not agreed to subscription"}]

 

 

This makes sense, as there's no payment info that was captured, either.

 

Does anyone have some pseudocode or step-wise examples of a process to automate seeding a Sandbox with the right things to support local development?

Login to Me Too
1 REPLY 1

MTS_Andre
Moderator
Moderator

Hi Drivewitherik, 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": "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J", "rel": "approve",

 

Then you can activate it.

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.