Sure. JSON Structure for Billing Agreement $client = new PayPalHttpClient($credentials);
$body = '{
"name": "' . $buyer['title'] . '",
"description": "' . $buyer['description'] . '",
"start_date": "' . date('Y-m-d\Tg:i:s\Z', strtotime('+1 days')) . '",
"payer": {
"payment_method": "paypal",
"payer_info": {
"first_name": "' . $buyer['first_name'] . '",
"last_name": "' . $buyer['last_name'] . '",
"email": "' . $buyer['email'] . '",
"billing_address": {
"line1": "' . $buyer['billing']['line1'] . '",
"line2": "' . $buyer['billing']['line2'] . '",
"city": "' . $buyer['billing']['city'] . '",
"state": "' . $buyer['billing']['state'] . '",
"country_code": "' . $buyer['billing']['country_code'] . '",
"postal_code": "' . $buyer['billing']['postal_code'] . '"
},
"shipping_address": {
"line1": "' . $buyer['billing']['line1'] . '",
"line2": "' . $buyer['billing']['line2'] . '",
"city": "' . $buyer['billing']['city'] . '",
"state": "' . $buyer['billing']['state'] . '",
"country_code": "' . $buyer['billing']['country_code'] . '",
"postal_code": "' . $buyer['billing']['postal_code'] . '"
}
}
},
"plan": {
"id": "' . $plan_id . '"
}
}';
$request = new AgreementCreateRequest(); Buyer Array for Billing Agreement Array ( [user_id] => 1 [company] => [first_name] => John [last_name] => Die [email] => email-removed [title] => Product Title [description] => Product Description [billing] => Array ( [line1] => 1234 Main Street [line2] => [city] => Atlanta [state] => GA [country_code] => US [postal_code] => 30326 ) ) JSON sent from AgreementCreateRequest { "name": "Product Title", "description": "Product Description", "start_date": "2018-04-06T11:58:03Z", "payer": { "payment_method": "paypal", "payer_info": { "first_name": "John", "last_name": "Die", "email": "email-removed", "billing_address": { "line1": "1234 Main Street", "line2": "", "city": "Atlanta", "state": "GA", "country_code": "US", "postal_code": "30326" }, "shipping_address": { "line1": "1234 Main Street", "line2": "", "city": "Atlanta", "state": "GA", "country_code": "US", "postal_code": "30326" } } }, "plan": { "id": "P-13P40544TB028345SS2DWOFY" } }
... View more