Subscription Application Context

November 13, 2025 ยท View on GitHub

The application context, which customizes the payer experience during the subscription approval process with PayPal.

Structure

SubscriptionApplicationContext

Fields

NameTypeTagsDescriptionGetterSetter
BrandNameStringOptionalThe label that overrides the business name in the PayPal account on the PayPal site.

Constraints: Minimum Length: 1, Maximum Length: 127, Pattern: ^.*$
String getBrandName()setBrandName(String brandName)
LocaleStringOptionalThe BCP 47-formatted locale of pages that the PayPal payment experience shows. PayPal supports a five-character code. For example, da-DK, he-IL, id-ID, ja-JP, no-NO, pt-BR, ru-RU, sv-SE, th-TH, zh-CN, zh-HK, or zh-TW.

Constraints: Minimum Length: 2, Maximum Length: 10, Pattern: ^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|[0-9]{3}))?$
String getLocale()setLocale(String locale)
ShippingPreferenceExperienceContextShippingPreferenceOptionalThe location from which the shipping address is derived.

Default: ExperienceContextShippingPreference.GET_FROM_FILE

Constraints: Minimum Length: 1, Maximum Length: 24, Pattern: ^[A-Z_]+$
ExperienceContextShippingPreference getShippingPreference()setShippingPreference(ExperienceContextShippingPreference shippingPreference)
UserActionApplicationContextUserActionOptionalConfigures the label name to Continue or Subscribe Now for subscription consent experience.

Default: ApplicationContextUserAction.SUBSCRIBE_NOW

Constraints: Minimum Length: 1, Maximum Length: 24, Pattern: ^[A-Z_]+$
ApplicationContextUserAction getUserAction()setUserAction(ApplicationContextUserAction userAction)
PaymentMethodPaymentMethodOptionalThe customer and merchant payment preferences.PaymentMethod getPaymentMethod()setPaymentMethod(PaymentMethod paymentMethod)
ReturnUrlStringRequiredThe URL where the customer is redirected after the customer approves the payment.

Constraints: Minimum Length: 10, Maximum Length: 4000
String getReturnUrl()setReturnUrl(String returnUrl)
CancelUrlStringRequiredThe URL where the customer is redirected after the customer cancels the payment.

Constraints: Minimum Length: 10, Maximum Length: 4000
String getCancelUrl()setCancelUrl(String cancelUrl)

Example (as JSON)

{
  "shipping_preference": "GET_FROM_FILE",
  "user_action": "SUBSCRIBE_NOW",
  "return_url": "return_url0",
  "cancel_url": "cancel_url2",
  "brand_name": "brand_name8",
  "locale": "locale2",
  "payment_method": {
    "payee_preferred": "UNRESTRICTED"
  }
}