{
    "description" : "This operation creates agreement having PayPal as payment option",    
    "title" : "Agreement created having PayPal as payment option",
    "runnable" : true, 
    "operationId" : "agreement.create", 
    "user" : { 
        "scopes" : [ "https://uri.paypal.com/services/subscriptions"]  
    },
    "credentials" : {
        "oauth": {
            "path" : "/v1/oauth/token",
            "clientId":"",    
            "clientSecret":""
        }
    },
    "request" : {
        "path" : "v1/payments/billing-agreements/",
        "method" : "POST",
        "headers" : {},
        "body" : 
        {
	     "name":"Override Agreement",
	     "description": "Agreement where merchant preferences and charge model is overridden",
	     "start_date" : "2014-06-17T03:05:05Z",
	     "payer":{ 
	               "payment_method":"paypal",
	              "payer_info":
	              {
				       "email":"kkarunanidhi-per1@paypal.com" 
		       }
	       },     
	     "plan":{
	               "id":"P-1WJ68935LL406420PUTENA2I"
	    },
	    "shipping_address":{
	                "line1":"Hotel Staybridge",
	                 "line2":"Crooke Street",
	                 "city":"San Jose",
	                 "state":"CA",
	                 "postal_code":"95112",
	                 "country_code":"US" 
	      },  
	     "override_merchant_preferences":{
	 		"setup_fee": {
	 			"value" : "3",
	 			"currency" : "GBP"
	 		},
	 		"return_url":"http://indiatimes.com",
	 		"cancel_url":"http://rediff.com",
	 		 "auto_bill_amount": "YES",
	 		 "initial_fail_amount_action": "CONTINUE",
	 		 "max_fail_attempts": "11"
	 	}, 
		"override_charge_models":[
			{
			  "charge_id": "CHM-8373958130821962WUTENA2Q",
			  "amount": { 
	          			"value" :"1",
	          			"currency" : "GBP"
	        		}
			}
		]
	    
	}


    },
    "response" : {
        "status" : "201 Created",
        "headers" : {},
        "body" : 
        {
	    "name": "Override Agreement",
	    "description": "Agreement where merchant preferences and charge model is overridden",
	    "plan": {
	        "id": "P-1WJ68935LL406420PUTENA2I",
	        "state": "ACTIVE",
	        "name": "Fast Speed Plan",
	        "description": "Vanilla plan",
	        "type": "INFINITE",
	        "payment_definitions": [
	            {
	                "id": "PD-9WG6983719571780GUTENA2I",
	                "name": "Payment Definition-1",
	                "type": "REGULAR",
	                "frequency": "Day",
	                "amount": {
	                    "currency": "GBP",
	                    "value": "10"
	                },
	                "charge_models": [
	                    {
	                        "id": "CHM-8373958130821962WUTENA2Q",
	                        "type": "SHIPPING",
	                        "amount": {
	                            "currency": "GBP",
	                            "value": "1"
	                        }
	                    },
	                    {
	                        "id": "CHM-2937144979861454NUTENA2Q",
	                        "type": "TAX",
	                        "amount": {
	                            "currency": "GBP",
	                            "value": "2"
	                        }
	                    }
	                ],
	                "cycles": "0",
	                "frequency_interval": "1"
	            },
	            {
	                "id": "PD-89M493313S710490TUTENA2Q",
	                "name": "Payment Definition-1",
	                "type": "TRIAL",
	                "frequency": "Month",
	                "amount": {
	                    "currency": "GBP",
	                    "value": "100"
	                },
	                "charge_models": [
	                    {
	                        "id": "CHM-78K47820SS4923826UTENA2Q",
	                        "type": "SHIPPING",
	                        "amount": {
	                            "currency": "GBP",
	                            "value": "10"
	                        }
	                    },
	                    {
	                        "id": "CHM-9M366179U7339472RUTENA2Q",
	                        "type": "TAX",
	                        "amount": {
	                            "currency": "GBP",
	                            "value": "12"
	                        }
	                    }
	                ],
	                "cycles": "5",
	                "frequency_interval": "2"
	            }
	        ],
	        "merchant_preferences": {
	            "setup_fee": {
	                "currency": "GBP",
	                "value": "3"
	            },
	            "max_fail_attempts": "11",
	            "return_url": "http://indiatimes.com",
	            "cancel_url": "http://rediff.com",
	            "auto_bill_amount": "YES",
	            "initial_fail_amount_action": "CONTINUE"
	        }
	    },
	    "links": [
	        {
	            "href": "https://stage2p2163.qa.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-83C745436S346813F",
	            "rel": "approval_url",
	            "method": "REDIRECT"
	        },
	        {
	            "href": "https://stage2p2163.qa.paypal.com/v1/payments/billing-agreements/EC-83C745436S346813F/agreement-execute",
	            "rel": "execute",
	            "method": "POST"
	        }
	    ],
	    "start_date": "2014-06-17T03:05:05Z"
	}
    }
}
