createVaultCardSetupToken mutation
data-variant=info
data-slots=text
The createVaultCardSetupToken mutation creates a temporary setup_token associated to the given payment source.
Use this token to create a permanent token with the createVaultCardPaymentToken mutation. The permanent token represents a payment method that is saved to the customer's vault.
The setup token is generated with an empty card number in the payment_source object purposefully. The PayPal SDK, in conjunction with hosted fields or credit cards field components, securely update the setup token with payment details.
See Paypal SDK developer documentation for more information.
Syntax
mutation {
createVaultCardSetupToken(
input: CreateVaultCardSetupTokenInput!
) CreateVaultCardSetupTokenOutput
}
Reference
The createVaultCardSetupToken reference provides detailed information about the types and fields defined in this mutation.
Example usage
The following example runs the createVaultCardSetupToken mutation to create a setup token for the given payment details.
Request:
mutation {
createVaultCardSetupToken(
input: {
setup_token: {
payment_source: {
card: {
name: "John Doe",
billing_address: {
address_line_1: "123 Main Street",
address_line_2: "Apt 4B",
region: "California",
city: "San Jose",
postal_code: "90001",
country_code: "US"
}
}
}
},
three_ds_mode: SCA_ALWAYS
}
) {
setup_token
}
}
Response:
{
"data": {
"createVaultCardSetupToken": {
"setup_token": "11M29729J2618171X"
}
}
}
Input attributes
The CreateVaultCardSetupTokenInput object must contain the following attributes:
setup_tokenthree_ds_modeOFF, SCA_ALWAYS, SCA_WHEN_REQUIREDThreeDSMode enum values
OFFSCA_ALWAYSSCA_WHEN_REQUIREDVaultSetupTokenInput attribute
The VaultSetupTokenInput object describes the variables needed to create a vault card setup token. Requires the following attribute:
payment_sourcePaymentSourceInput attribute
The PaymentSourceInput object describes the payment source information of the payment method.
cardCardPaymentSourceInput object
The CardPaymentSourceInput object describes the card payment source information.
billing_addressnameBillingAddressPaymentSourceInput object
The BillingAddressPaymentSourceInput object includes the billing address information
address_line_1address_line_2regioncitypostal_codecountry_codeOutput attributes
The createVaultCardSetupTokenOutput object contains the following attribute:
setup_token