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"
}
}
}