Create Payment Token Input

June 5, 2026 ยท View on GitHub

Input structure for the method CreatePaymentTokenAsync

Structure

CreatePaymentTokenInput

Fields

NameTypeTagsDescriptionGetterSetter
ContentTypeStringRequired, ConstantValue: "application/json"String getContentType()setContentType(String contentType)
BodyPaymentTokenRequestRequiredPayment Token creation with a financial instrument and an optional customer_id.PaymentTokenRequest getBody()setBody(PaymentTokenRequest body)
PaypalRequestIdStringOptionalThe server stores keys for 3 hours.

Constraints: Minimum Length: 1, Maximum Length: 108, Pattern: ^.*$
String getPaypalRequestId()setPaypalRequestId(String paypalRequestId)

Example

import com.paypal.sdk.models.CardBrand;
import com.paypal.sdk.models.CreatePaymentTokenInput;
import com.paypal.sdk.models.Customer;
import com.paypal.sdk.models.PaymentTokenRequest;
import com.paypal.sdk.models.PaymentTokenRequestCard;
import com.paypal.sdk.models.PaymentTokenRequestPaymentSource;
import com.paypal.sdk.models.VaultTokenRequest;
import com.paypal.sdk.models.VaultTokenRequestType;

CreatePaymentTokenInput createPaymentTokenInput = new CreatePaymentTokenInput.Builder(
    "application/json",
    new PaymentTokenRequest.Builder(
        new PaymentTokenRequestPaymentSource.Builder()
            .card(new PaymentTokenRequestCard.Builder()
                .name("name6")
                .number("number6")
                .expiry("expiry4")
                .securityCode("security_code8")
                .brand(CardBrand.CB_NATIONALE)
                .build())
            .token(new VaultTokenRequest.Builder(
                "id6",
                VaultTokenRequestType.SETUP_TOKEN
            )
            .build())
            .build()
    )
    .customer(new Customer.Builder()
            .id("id0")
            .merchantCustomerId("merchant_customer_id2")
            .build())
    .build()
)
.paypalRequestId("PayPal-Request-Id6")
.build();