File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 223
223
*/
224
224
class RestPurchaseRequest extends RestAuthorizeRequest
225
225
{
226
+ const SHIPPING_PREFERENCE_NO_SHIPPING = 'NO_SHIPPING ' ;
227
+ const SHIPPING_PREFERENCE_GET_FROM_FILE = 'GET_FROM_FILE ' ;
228
+ const SHIPPING_PREFERENCE_SET_PROVIDED_ADDRESS = 'SET_PROVIDED_ADDRESS ' ;
229
+
226
230
public function getData ()
227
231
{
228
232
$ data = parent ::getData ();
229
233
$ data ['intent ' ] = 'sale ' ;
234
+ $ data ['application_context ' ]['shipping_preference ' ] = $ this ->getShippingPreference ();
230
235
return $ data ;
231
236
}
237
+
238
+ public function getShippingPreference ()
239
+ {
240
+ return $ this ->getParameter ('shippingPreference ' );
241
+ }
242
+
243
+ /**
244
+ * Set the shipping preference
245
+ *
246
+ * Supported values:
247
+ * 'NO_SHIPPING': redacts shipping address fields from the PayPal pages.
248
+ * Recommended value to use for digital goods.
249
+ * 'GET_FROM_FILE': Get the shipping address selected by the buyer on PayPal pages.
250
+ * 'SET_PROVIDED_ADDRESS' (not yet fully supported by the library since shipping address can't be provided):
251
+ * Use the address provided by the merchant. Buyer is not able to change the address on the PayPal pages.
252
+ * If merchant doesn't pass an address, buyer has the option to choose the address on PayPal pages.
253
+ *
254
+ * @param string $value
255
+ * @return bool.
256
+ * @link https://developer.paypal.com/docs/api/orders/#definition-application_context
257
+ * @link https://www.paypalobjects.com/api/checkout.js
258
+ */
259
+ public function setShippingPreference ($ value )
260
+ {
261
+ return $ this ->setParameter ('shippingPreference ' , $ value );
262
+ }
232
263
}
You can’t perform that action at this time.
0 commit comments