customerPaymentMethodCreditCardCreate mutation

Creates a credit card payment method for a customer.

Required access

write_customers access scope.


On this page


Interactive example

This is an example mutation query. Use the embedded interactive tool below to edit the query.

Hint: use Ctrl + Space for autocompleting fields.

mutation customerPaymentMethodCreditCardCreate($customerId: ID!, $billingAddress: MailingAddressInput!, $sessionId: String!) { customerPaymentMethodCreditCardCreate(customerId: $customerId, billingAddress: $billingAddress, sessionId: $sessionId) {
  1. <font style="color:#1F61A0;">customerPaymentMethod</font> <font style="color:#555555;">{</font>
  2. <font style="color:#1F61A0;">id</font>
  3. <font style="color:#555555;">}</font>
  4. <font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font>
  5. <font style="color:#1F61A0;">field</font>
  6. <font style="color:#1F61A0;">message</font>
  7. <font style="color:#555555;">}</font>
} } { “customerId”: “Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=”, “billingAddress”: {}, “sessionId”: “placeholder” }


Arguments

Argument Description
billingAddress
(
[MailingAddressInput!](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/mailingaddressinput)

) REQUIRED
The billing address.
customerId
(
[ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01)

) REQUIRED
The ID of the customer.
sessionId
(
[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)

) REQUIRED
The Cardserver session ID.


MailingAddressInput fields

  • address1 ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The first line of the address. Typically the street address or PO Box number.
  • address2 ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The second line of the address. Typically the number of the apartment, suite, or unit.
  • city ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The name of the city, district, village, or town.
  • company ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The name of the customer’s company or organization.
  • country ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The name of the country. This argument is deprecated: Use countryCode instead.
  • countryCode ([CountryCode](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/countrycode))
    The two-letter code for the country of the address.
  • firstName ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The first name of the customer.
  • id ([ID](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
    This argument is deprecated: Not needed for 90% of mutations, and provided separately where it is needed.
  • lastName ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The last name of the customer.
  • phone ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    A unique phone number for the customer.
    Formatted using E.164 standard. For example, +16135551111.
  • province ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The region of the address, such as the province, state, or district. This argument is deprecated: Use provinceCode instead.
  • provinceCode ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The code for the region of the address, such as the province, state, or district. For example QC for Quebec, Canada.
  • zip ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The zip or postal code of the address.


Return fields

  • customerPaymentMethod ([CustomerPaymentMethod](https://shopify.dev/docs/admin-api/graphql/reference/customers/customerpaymentmethod))
    The customer payment method.
  • userErrors ([[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror))
    List of errors that occurred executing the mutation.