Process payments using third-party network token processing
Last updated: May 21st, 5:16pm
PayPal supports third-party network token processing for merchants and partners.
Availability
This integration is available in the following countries:
- Australia
- Austria
- Belgium
- Bulgaria
- Canada
- China
- Cyprus
- Czech Republic
- Denmark
- Estonia
- Finland
- France
- Germany
- Hungary
- Ireland
- Italy
- Latvia
- Liechtenstein
- Lithuania
- Luxembourg
- Malta
- Netherlands
- Norway
- Poland
- Portugal
- Romania
- Slovakia
- Slovenia
- Spain
- Sweden
- United Kingdom
- United States
For more information, contact Sales.
Tokenization
Tokenization keeps payment information private by turning card numbers into unique tokens, which are stored securely and used instead of the original card.
Tokenization creates a unique credential, or token, for a card that is different from its 15- or 16-digit primary account number. The merchant only sends the token, rather than the underlying account number. A network token only works for a specific card and merchant.
The benefits of using network tokens include:
- Improved authorization rates.
- Increased security by reducing opportunities for data theft and using cryptograms to protect credentials.
- Potentially reduced transaction-processing costs.
- Simplified payment processing.
- Helps maintain Payment Card Industry Data Security Standard compliance.
Third-party network token
A third-party network token represents a payment method that is either:
- Saved in-house by the partner or merchant.
- Saved by an external Token Service Provider (TSP).
Third-party network token processing happens when PayPal processes a payment using a token that PayPal didn't create.
How it works
Integrate with third-party network token payments as follows:
- Save and tokenize a payer's payment method.
- Get a token number and expiration date to use for payments.
- Use this token when sending a payment through PayPal.
- PayPal processes the payment as a regular credit or debit card purchase.
Note: Third-party tokens aren't stored and can't be created, mapped, unmapped, or validated against their primary account number.
Know before you code
RequiredThird-party token integration liability
You acknowledge and agree that you are solely responsible for any third-party vaulting functionality (not provided by PayPal) that you use and PayPal will, under no circumstances, be responsible or liable for any damages, losses or costs whatsoever suffered or incurred by you as a result of using a third-party vaulting functionality on PayPal’s platforms (including Products), services, or APIs.
Note: Third-party network token integrations don’t support reference or future transactions. Don’t pass a reference transaction ID using the payment_source.token.id
parameter.
Using third-party network tokens with PayPal
Review this section to learn how to integrate third-party network tokens in your PayPal integration.
Sample third-party token processing request for direct merchants
This code sample shows a third-party network token in the body of a POST
call to the Create order endpoint of the Orders v2 API. This request creates a new order and completes the payment in a single step by declaring the intent
as CAPTURE
.
The payment request includes the new network_token
and stored_credential
objects:
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \2-H 'Content-Type: application/json' \3-H 'PayPal-Request-Id: REQUEST-ID' \4-H 'Authorization: Bearer ACCESS-TOKEN' \5-d '{6 "intent": "CAPTURE",7 "purchase_units": [8 {9 "reference_id": "REFID-000-1001",10 "amount": {11 "currency_code": "USD",12 "value": "100.00"13 }14 }15 ],16 "payment_source": {17 "card": {18 "name": "Firstname Lastname",19 "network_token": {20 "number": "4444444444444444",21 "expiry": "2030-11",22 "eci_flag": "NON_3D_SECURE_TRANSACTION",23 "token_requestor_id": "12324"24 },25 "stored_credential": {26 "payment_initiator": "MERCHANT",27 "payment_type": "UNSCHEDULED",28 "usage": "SUBSEQUENT",29 "previous_network_transaction_reference": {30 "id": "NETWORK-TRANSACTION-REFERENCE-ID",31 "network": "VISA"32 }33 }34 }35 }36}'
-
Lines 19-24: The
payment_source.card.network_token
object contains details about the third-party network token. PayPal passes this information to the issuer. Seenetwork_token
for more details. -
Line 22: Token service providers give each third-party network token a 2-digit Electronic Commerce Indicator (ECI) code. When you make a payment using a third-party network token, your integration needs to change the 2-digit ECI code to the corresponding string from the table below. Pass this value using the
payment_source.card.network_token.eci_flag
parameter. This value is required for customer-initiated payments and optional for merchant-initiated payments:Numeric ECI code String 00
MASTERCARD_NON_3D_SECURE_TRANSACTION
07
NON_3D_SECURE_TRANSACTION
-
Lines 25-33: The
payment_source.card.stored_credential
object contains details about the type of card-on-file payment. Seestored_credential
for more details.
Sample third-party token processing response for direct merchants
The HTTP 201
response includes the new bin_details
and network_transaction_reference
objects:
1{2 "id": "ORDER-ID",3 "status": "COMPLETED",4 "payment_source": {5 "card": {6 "name": "Firstname Lastname",7 "last_digits": "4444",8 "expiry": "2030-11",9 "brand": "VISA",10 "available_networks": [11 "VISA"12 ],13 "type": "CREDIT",14 "bin_details": {15 "bin": "43999450",16 "issuing_bank": "CREDIT UNION OF OHIO",17 "bin_country_code": "US",18 "products": [19 "CONSUMER"20 ]21 }22 }23 },24 "purchase_units": [25 {26 "reference_id": "REFID-000-1001",27 "payment_instruction": {28 ...29 },30 "shipping": {31 ...32 },33 "payments": {34 "captures": [35 {36 "id": "ORDER-ID",37 "status": "COMPLETED",38 "amount": {39 "currency_code": "USD",40 "value": "50.00"41 },42 "final_capture": true,43 "disbursement_mode": "DELAYED",44 "seller_protection": {45 "status": "NOT_ELIGIBLE"46 },47 "seller_receivable_breakdown": {48 ...49 },50 "invoice_id": "INVID-21-07-2023-05-56-55",51 "custom_id": "CUSTOMID-1001",52 "links": [53 ...54 ],55 "create_time": "2023-07-21T12:27:00Z",56 "update_time": "2023-07-21T12:27:00Z",57 "processor_response": {58 "avs_code": "Y",59 "cvv_code": "X",60 "response_code": "0000"61 },62 "network_transaction_reference": {63 "id": "NETWORK-TRANSACTION-REFERENCE-ID",64 "network": "VISA"65 }66 }67 ]68 }69 }70 ],71 "links": [72 ...73 ]74}
- Lines 14-18: The
payment_source.card.bin_details
object contains the bank identification number (BIN) information. Seebin_details
for more details. - Lines 59-62: The
purchase_units.payments.captures.network_transaction_reference
object includes theid
andnetwork
name. Seenetwork_transaction_reference
for more details.
Third-party network token processing test scenarios
In the PayPal sandbox, you can use test cards to simulate third-party network token payment scenarios.
The test scenario on this page shows a successful payment capture with the following details:
- Merchant enrolled with Expanded Checkout.
- Customer-initiated payment.
- Externally provisioned token and cryptogram. Cryptograms are optional for MITs.
Test cards
Use the following test cards as third-party network tokens. Pass the test card number in the body of the request using payment_source.card.network_token.number
.
Tip: Enter a future expiration date when testing these card network tokens.
Card brand | Test card | Cryptogram |
---|---|---|
Visa | 4034772286582057 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Visa | 4556871409493313 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Mastercard | 5530238208956601 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Mastercard | 5419720028804901 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Amex | 379015087078375 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Discover | 6011390662682995 |
"cryptogram":"ApIPtIgAMyrMgTx1RSnAMAACAAA=" |
Test the third-party network payment token for each card brand by sending a POST
call to the Capture payment for order endpoint of the Orders v2 API with the following values:
- Pass the third-party network payment token for that card brand in the body of the request using the
payment_source.card.network_token.number
parameter. - Enter a future expiration date using
payment_source.card.network_token.expiry
. - Pass the cryptogram
ApIPtIgAMyrMgTx1RSnAMAACAAA=
using thepayment_source.card.network_token.cryptogram
parameter. - Pass the Electronic Commerce Indicator (ECI) flag for the third-party network payment token using the
payment_source.card.network_token.eci_flag
parameter. For MasterCard, passMASTERCARD_NON_3D_SECURE_TRANSACTION
. For other cards, passNON_3D_SECURE_TRANSACTION
.
Sample create order using a third-party network token
The transaction starts when you send a POST
call to the Create order endpoint of the Orders v2 API.
A successful create order request returns the HTTP 201 Created
status code and a JSON response body that includes by default a minimal response with the ID, status, and HATEOAS links.
Capture URL: https://api-m.sandbox.paypal.com/v2/checkout/orders
- Sample create order request
- Sample create order response
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \2-H 'Content-Type: application/json' \3-H 'PayPal-Request-Id: REQUEST-ID' \4-H 'Authorization: Bearer BEARER-TOKEN' \5-d '{6 "intent": "CAPTURE",7 "purchase_units": [8 {9 "reference_id": "reference_id_1_5.00",10 "payment_group_id": "1",11 "description": "Description of PU-1",12 "custom_id": "custom_id_1_5.00",13 "soft_descriptor": "soft_descr_1_5.00",14 "invoice_id": "invoice_id_create_order_1_1740637790",15 "amount": {16 "currency_code": "USD",17 "value": "5.00",18 "breakdown": {19 "item_total": {20 "currency_code": "USD",21 "value": "5.00"22 },23 "shipping": {24 "currency_code": "USD",25 "value": "0.00"26 },27 "handling": {28 "currency_code": "USD",29 "value": "0.00"30 },31 "tax_total": {32 "currency_code": "USD",33 "value": "0.00"34 },35 "gift_wrap": {36 "currency_code": "USD",37 "value": "0.00"38 },39 "shipping_discount": {40 "currency_code": "USD",41 "value": "0.00"42 }43 }44 },45 "items": [46 {47 "name": "Mug",48 "description": "Coffee Mug",49 "sku": "259483234812",50 "unit_amount": {51 "currency_code": "USD",52 "value": "5.00"53 },54 "tax": {55 "currency_code": "USD",56 "value": "0.00"57 },58 "quantity": "1",59 "category": "DIGITAL_GOODS"60 },61 {62 "name": "Mark-Up (0%)",63 "description": "Buyer Mark-Up Amount",64 "sku": "2594832348111",65 "unit_amount": {66 "currency_code": "USD",67 "value": "0.00"68 },69 "tax": {70 "currency_code": "USD",71 "value": "0.00"72 },73 "quantity": "1",74 "category": "DIGITAL_GOODS"75 }76 ],77 "payee": {78 "email_address": "payee@example.com",79 "display_data": {80 "business_email": "business@example.com",81 "brand_name": "PayPal Shop",82 "business_phone": {83 "country_code": "39",84 "national_number": "222-222-2222",85 "extension_number": "1"86 }87 }88 },89 "payment_instruction": {90 "disbursement_mode": "INSTANT",91 "platform_fees": [92 {93 "amount": {94 "currency_code": "USD",95 "value": "1.25"96 },97 "payee": {98 "email_address": "payee@example.com"99 }100 }101 ],102 "payee_pricing_tier_id": ""103 },104 "shipping": {105 "address": {106 "shipping_name": "Firstname Lastname",107 "phone": "555-555-5555",108 "address_line_1": "123 Main St.",109 "address_line_2": "#100",110 "admin_area_1": "CA",111 "admin_area_2": "Anytown",112 "postal_code": "12345",113 "country_code": "US",114 "address_details": {}115 },116 "method": "UPS"117 }118 }119 ],120 "payment_source": {121 "card": {122 "network_token": {123 "number": "4444444444444444",124 "expiry": "2029-01",125 "cryptogram": "ApIPtIgAMyrMgTx1RSnAMAACAAA=",126 "eci_flag": "NON_3D_SECURE_TRANSACTION",127 "token_requestor_id": "VK123PTR"128 }129 }130 },131 "application_context": {132 "locale": "en-US",133 "landing_page": "BILLING",134 "shipping_preference": "SET_PROVIDED_ADDRESS",135 "user_action": "PAY_NOW",136 "return_url": "https://example.com/returnUrl",137 "cancel_url": "https://example.com/cancelUrl"138 }139}'
Sample capture order request and response using a third-party network token
The following code sample shows a capture order request using a third-party network token for a Visa card. The response includes a network_transaction_reference
object showing the network transaction reference ID, and the card network, Visa. The Visa network doesn't return an expiration date
.
Capture URL: https://api-m.sandbox.paypal.com/v2/checkout/orders/ORDER-ID/capture
- Sample capture order request
- Sample capture order response
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders/ORDER-ID/capture \2-H 'Content-Type: application/json' \3-H 'PayPal-Request-Id: REQUEST-ID' \4-H 'Authorization: Bearer BEARER-TOKEN' \5-d '{6 "payment_source": {7 "card": {8 "network_token": {9 "number": "4444444444444444",10 "expiry": "2029-01",11 "cryptogram": "ApIPtIgAMyrMgTx1RSnAMAACAAA=",12 "eci_flag": "NON_3D_SECURE_TRANSACTION",13 "token_requestor_id": "VK123PTR"14 }15 }16 }17}'
Capture order response details
A successful response to a non-idempotent request returns the HTTP 201 Created
status code with a JSON response body that shows captured payment details, including a network_transaction_reference
object. If the order request was already processed, the endpoint returns the HTTP 200 OK
status code to indicate an idempotent response.
The network_transaction_reference
object passes the reference values used by the card network to identify this transaction. See network_transaction_reference for details.