As mentioned for most part management of PayPal Vault transactions utilize the same API calls as a regular PayPal transaction. To review the regular PayPal API details see PayPal SetExpress, PayPal GetExpress, PayPal DoExpress and PayPal DoAuthorization

1. Set Express

The specific use-case for a Vault Id creation request with a purchase is for shoppers who are subscribing to a recurring payment (subscription) product or service.

URI Description

Action URI Template URI Example Request Content Type Response Content Type
POST /vM.m/stores/{StoreID}/payments/paypal/setExpress.xml /v1.0/stores/TMSUS/payments/paypal/setExpress.xml application/xml or text/xml application/xml or text/xml

Request Elements

When preparing the request, consider the following data notes:

  • Negative Line Items Amounts are allowed in order to apply discounts, and LineItemsTotal is also allowed to have a negative value. However, the request Amount, which equals the sum of LineItemsTotal + ShippingTotal + TaxTotal, cannot be negative.
  • AddressOverride must be set to 0 if the user chooses Express checkout, or 1 if the user chooses Standard checkout.

PayPal Vault Without Purchase Specific Elements

Since Merchants are initiating a Vault transaction without a purchase, set the Recurring field to true and specify an amount greater than 0 in the SetExpress request.

Optionally, set the AutoCapture flag to true, based on Merchant's requirements.

Also, include the Customer Id in the request.

Element Required Description Type Restriction
StoreId Yes Store identifier used in the URL. String 20 Characters
OrderId Yes Order identifier. String 20 Characters
ReturnUrl Yes URL to which the customer's browser is returned after choosing to pay with PayPal. String Cannot be empty. (Minimum of 1 character)
CancelUrl Yes URL to which the customer is returned if the customer does not approve the use of PayPal. String Cannot be empty. (Minimum of 1 character)
LocaleCode Yes Locale code for the user's language in combination with a country. String Cannot be empty. (Minimum of 1 character). Example: en_US
Amount Yes For a creation of a Vault id with a purchase the amount should be greater than 0.00 Decimal 2 precision points. (123.34)
Amount/
@currencyCode
Yes Type of currency used for the order String 3-character ISO 4217 code (for example, USD, CAD, EUR). See http://en.wikipedia.org/
wiki/ISO_4217.
AddressOverride No Identifies Express Checkout (set to 0) or Standard Checkout (set to 1). String 0, 1
NoShippingAddressDisplay No Hides shipping address on PayPal checkout review page when set to 1. Shows the shipping address when set to 0 or when not specified. When set to 2 will display the shipping address. If the shipping address is not provided it will be obtained from the buyer's account information. String 0, 1, 2
ShipToName No The name of the person shipped to String 128 Characters
ShippingAddress No Address the order will be shipped to. Complex Type Includes: Line1, Line2, Line3, Line4, City, MainDivision, CountryCode, PostalCode
ShippingAddress/
Line1
Yes Line 1 of the address. String Between 1 and 70 Characters.
ShippingAddress/
Line2
No Line 2 of the address. String Between 1 and 70 Characters.
ShippingAddress/
Line3
No Line 3 of the address. String Between 1 and 70 Characters.
ShippingAddress/
Line4
No Line 4 of the address. String Between 1 and 70 Characters.
ShippingAddress/
City
Yes City the order will be shipped to. String Between 1 and 40 Characters.
ShippingAddress/
MainDivision
No This is the State/Province name String Between 1 and 35 Characters. Use of the ISO 3166-2 code is recommended but not required.
ShippingAddress/
CountryCode
Yes Country the order will be shipped to. String 2 Characters.

Two digit ISO 3166 alpha 2 code country code. See: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

ShippingAddress/
PostalCode
No Postal Code the order will be shipped to. String Between 1 and 15 Characters.
ShippingOptions No Shipping options provided for the customer to choose Complex Type Includes: ShippingId and multiple ShippingOption (Applicable for PayPal Version 2 only)
ShippingOptions/
ShippingId
No It represents the shipping option that the payee or merchant expects to be pre-selected for the payer when they first view the shipping String Between 1 and 127 Characters
ShippingOption No Represent a single shipping option Complex Type Includes: ShippingId, ShippingLabel, DeliveryOption and ShippingCost
ShippingOptions/
ShippingId
No A unique ID that identifies a payer-selected shipping option. String Between 1 and 127 Characters.
ShippingOptions/
ShippingLabel
No A description that the payer sees, which helps them choose an appropriate shipping option. For example, Free Shipping, USPS Priority Shipping, Expédition prioritaire USPS, or USPS yōuxiān fā huò. String Between 1 and 127 Characters.
ShippingOptions/
DeliveryOption
No The method by which the payer wants to get their items. SHIPPING or PICKUP String Between 1 and 15 Characters.
ShippingOptions/
ShippingCost
No The shipping cost for the selected option. Decimal 2 precision points. (123.34).
ShippingOptions/
@currencyCode
No Type of currency used for the order String 3-character ISO 4217 code (for example, USD, CAD, EUR). See http://en.wikipedia.org/
wiki/ISO_4217.
LineItems No Represents the items in the Order. Complex Type Includes: LineItemsTotal, ShippingTotal, TaxTotal and multiple LineItem elements.
LineItems/
LineItemsTotal
Yes Total amount for all line items excluding shipping and tax. Calculated as: LineItemsTotal = (First-LineItem-Quantity * First-LineItem-Amount) + other line items. Decimal 2 precision points. (123.34). Negative is allowed. However, LineItemsTotal + ShippingTotal + TaxTotal cannot be negative.
LineItems/
ShippingTotal
Yes Total shipping amount for all line items. Decimal 2 precision points. (123.34).
LineItems/
TaxTotal
Yes Total tax amount for all line items. Decimal 2 precision points. (123.34).
LineItems/
LineItem
No Represents a single item on the order. Complex Type Includes: Name, SequenceNumber, Quantity, UnitAmount
LineItems/
LineItem/
Name
Yes Line item name. String No Restrictions.
LineItems/
LineItem/
SequenceNumber
No Sequence number of current line item in cart if available. String No Restrictions.
LineItems/
LineItem/
Quantity
Yes Quantity for this line item. Int No Restrictions.
LineItems/
LineItem/
UnitAmount
Yes Unit price amount for a line item. Decimal 2 precision points. (123.34). Negative is allowed.
Installment (deprecated with latest PayPal upgrade) No Indicates whether this payment will be made using PayPal's Credit installment payment. Boolean true/false
SolutionType (deprecated with latest PayPal upgrade) No Type of checkout flow.
  • Sole - Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional.
  • Mark - Buyer must have a PayPal account to check out.
Enum Mark / Sole
SchemaVersion Yes

Although marked as optional in the the schema, this element needs to be passed at all times with a value of 1.1 or greater in order to receive elements like 'ErrorMessage', 'ShortErrorMessage', 'ErrorCode' in the Response message.

String

pattern = "([0-9]+\.)*[0-9]+".
Value Example: 1.1, 1.2

Recurring true

Recurring is true to set up Vault for recurring payment, else it must be false.

Boolean true/false
AutoCapture No

If Merchant's payment is automatically captured immediately upon authorization, Enable the AutoCapture else Disable it.

Boolean true/false
CustomerId No

PayPal will automatically generate a Customer Id for the Shopper. If Merchants have a preferred Customer Id, they can pass it in the request.

String Between 1 and 22 Characters.
MerchantDescriptor No

Merchants to pass their soft description to be displayed on the shoppers PayPal statement, generally business name in short form.

String Min 1 characters Max 127 characters.

SetExpress Request Message

The request is a PayPalSetExpressCheckoutRequest message.

Copy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PayPalSetExpressCheckoutRequest xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>11111123</OrderId>
  <ReturnUrl>http://webstore.com/return</ReturnUrl>
  <CancelUrl>http://webstore.com/cancel</CancelUrl>
  <LocaleCode>en_US</LocaleCode>
  <Amount currencyCode="USD">100.00</Amount>
  <ShipToName>John Doe</ShipToName>
  <ShippingAddress>
    <Line1>630 Allendale Road</Line1>
    <City>King of Prussia</City>
    <MainDivision>PA</MainDivision>
    <CountryCode>US</CountryCode>
    <PostalCode>19406</PostalCode>
  </ShippingAddress>
  <ShippingOptions>
        <ShippingId>SHIP_123</ShippingId>
        <ShippingOption>
            <ShippingId>SHIP_123</ShippingId>
            <ShippingLabel>1-Day-Shipping</ShippingLabel>
            <DeliveryOption>SHIPPING</DeliveryOption>
            <ShippingCost currencyCode="USD">8.00</ShippingCost>
        </ShippingOption>
        <ShippingOption>
            <ShippingId>SHIP_124</ShippingId>
            <ShippingLabel>Free-Shipping</ShippingLabel>
            <DeliveryOption>SHIPPING</DeliveryOption>
            <ShippingCost currencyCode="USD">0.00</ShippingCost>
        </ShippingOption>
        <ShippingOption>
            <ShippingId>SHIP_456</ShippingId>
            <ShippingLabel>Pick up in Store</ShippingLabel>
            <DeliveryOption>PICKUP</DeliveryOption>
            <ShippingCost currencyCode="USD">0.00</ShippingCost>
        </ShippingOption>
  </ShippingOptions>
  <Recurring>true</Recurring>
  <SchemaVersion>1.2</SchemaVersion>
</PayPalSetExpressCheckoutRequest>


Response Elements

Element Required Description Type Restriction
OrderId Yes Order identifier. String 20 Characters
ResponseCode Yes Response Code returned from Payment Service. String Success, Failure
Token Yes The timestamped token value that was returned by PayPalSetExpressCheckoutReply and passed on PayPalGetExpressCheckoutRequest. String Generated by PayPal
ErrorMessage No Full Error Description. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.
ShortErrorMessage No Short Error Description. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.
ErrorCode No Error code coming from PayPal. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.

Success Response Example

The response is a PayPalSetExpressCheckoutReply message for Vault Id Creation with a purchase. The Token in response will be used for subsequent APIs.

Copy
<?xml version="1.0" encoding="UTF-8"?>
<PayPalSetExpressCheckoutReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<OrderId>12345</OrderId>
<ResponseCode>Success</ResponseCode>
                <Token>EC-5YE59312K56892714</Token>
</PayPalSetExpressCheckoutReply>
            

2. PayPal GetExpress

Use the same API calls as the standard PayPal GetExpress API.

For more information, see PayPal GetExpress.

3. PayPal DoExpress

Use the same API calls as the standard PayPal GetExpress API.

For more information, see PayPal DoExpress.

4. PayPal DoAuthorization

Use the same API calls as the standard PayPal DoAuthorization API.

This API also supports creating a Vault ID during the purchase, but only if the Recurring option is enabled in the PayPal SetExpress call.

The response includes additional fields, such as the Vault ID and Customer Id.

For more information, see PayPal DoAuthorization.

Response Elements

The Vault Id and Customer Id will be present in response, only if Recurring is enabled in PayPal SetExpress call.

Element Required Description Type Restriction
OrderId Yes Order Identifier. String 20 Characters
ResponseCode Yes Response code returned from Payment Service String 3 possible codes: Success, Failure, Timeout.
AuthorizationInfo No Details regarding the transaction. Complex Type Includes: PaymentStatus, PaymentReason, PaymentCode and VaultId
PaymentStatus No Status of the transaction on PayPal's site. String 64 Characters
VaultId No The PayPal-generated ID for the vault token. Vault Id will be present only when Vault is enabled. String 64 Characters
CustomerId Required PayPal customer id. Customer Id will be present only when Vault is enabled. String Min 4 characters
PaymentReason No Reason for the transaction's status on PayPal's site. String 64 Characters
PaymentCode No Code associated with the transaction on PayPal's site. String 64 Characters
ErrorMessage No Full Error Description. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.
ShortErrorMessage No Short Error Description. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.
ErrorCode No Error code coming from PayPal. String Present only when the ResponseCode is Failure and SchemaVersion in the Request is equal to or greater than 1.2.

Success Vault Response

If Vault is enabled for the purchase, the DoAuthorize response will return the 'Vault Id' and 'Customer Id'.

Copy
<?xml version="1.0" encoding="UTF-8"?>
                        <PayPalDoAuthorizationReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
                        <OrderId>12345</OrderId>
                        <ResponseCode>Success</ResponseCode>
                        <AuthorizationInfo>
                        <PaymentStatus>Pending</PaymentStatus>
                        <PendingReason>authorization</PendingReason>
                            <VaultId>7cl54443w0761992v</VaultId>
                            <CustomerId>7dfdf07fdfr</CustomerId>
                        <ReasonCode>1234</ReasonCode>
                        </AuthorizationInfo>
                    </PayPalDoAuthorizationReply>

Subscription Checkout With Vault Id

The Vault Id and the Customer Id received from the PayPal-DoAuthorization should be saved to the merchants wallet account for further payments.

The flow and details of enabling a Subscription Checkout with Vault Id are detailed Subscription Checkout With Vault Id