younifyd
Menu

cartPaymentUpdate

Update the customer's payment method that will be used to checkout.

Use it in a workflow

  1. Add a step and choose the Shopify Storefront connector.
  2. Pick the cartPaymentUpdate action (under Cart).
  3. Fill in the fields below, then reference the result from later steps as {{cartpaymentupdate.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation CartPaymentUpdate($cartId: ID!, $payment: CartPaymentInput!) {
  cartPaymentUpdate(cartId: $cartId, payment: $payment) {
    cart {
      appliedGiftCards {
        amountUsed
        amountUsedV2
        balance
        balanceV2
        id
        lastCharacters
        presentmentAmountUsed
      }
      attributes {
        key
        value
      }
      buyerIdentity {
        countryCode
        customer
        deliveryAddressPreferences
        email
        phone
        preferences
        purchasingCompany
      }
      checkoutUrl
      cost {
        checkoutChargeAmount
        subtotalAmount
        subtotalAmountEstimated
        totalAmount
        totalAmountEstimated
        totalDutyAmount
        totalDutyAmountEstimated
        totalTaxAmount
        totalTaxAmountEstimated
      }
      createdAt
      delivery
      discountAllocations {
        discountApplication
        discountedAmount
        sourceDiscountApplication
        targetType
      }
      discountApplications {
        allocationMethod
        targetSelection
        targetType
        totalAllocatedAmount
        value
      }
      discountCodes {
        applicable
        code
      }
      estimatedCost {
        checkoutChargeAmount
        subtotalAmount
        totalAmount
        totalDutyAmount
        totalTaxAmount
      }
      id
      note
      totalQuantity
      updatedAt
    }
    userErrors {
      code
      field
      message
    }
    warnings {
      code
      message
      target
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

cartIdstringrequired

The ID of the cart.

paymentobjectrequired

The payment information for the cart that will be used at checkout.

amountobjectrequired2 fields
sourceIdentifierstring
freePaymentMethodobject1 fields
directPaymentMethodobject4 fields
walletPaymentMethodobject2 fields
json
{
  "cartId": "string",
  "payment": {
    "amount": {
      "amount": "string",
      "currencyCode": "USD"
    },
    "sourceIdentifier": "string",
    "freePaymentMethod": {
      "billingAddress": {
        "address1": "string",
        "address2": "string",
        "city": "string",
        "company": "string",
        "country": "string",
        "firstName": "string",
        "lastName": "string",
        "phone": "string",
        "province": "string",
        "zip": "string"
      }
    },
    "directPaymentMethod": {
      "billingAddress": {
        "address1": "string",
        "address2": "string",
        "city": "string",
        "company": "string",
        "country": "string",
        "firstName": "string",
        "lastName": "string",
        "phone": "string",
        "province": "string",
        "zip": "string"
      },
      "sessionId": "string",
      "cardSource": "SAVED_CREDIT_CARD",
      "acceptedSubscriptionTerms": false
    },
    "walletPaymentMethod": {
      "applePayWalletContent": {
        "billingAddress": "string",
        "data": "string",
        "header": "string",
        "signature": "string",
        "version": "string",
        "lastDigits": "string"
      },
      "shopPayWalletContent": {
        "billingAddress": "string",
        "sessionToken": "string"
      }
    }
  }
}

Response

Read the result with {{cartpaymentupdate.response.data.data.cartPaymentUpdate}}. If the API returns errors, the step fails and they are at {{cartpaymentupdate.response.data.errors}}.

cartobject
appliedGiftCardsarray<object>
attributesarray<object>
buyerIdentityobject7 fields
checkoutUrlstring
costobject9 fields
createdAtstring
deliveryobject
discountAllocationsarray<object>
discountApplicationsarray<object>
discountCodesarray<object>
estimatedCostobject5 fields
idstring
notestring
totalQuantitynumber
updatedAtstring
userErrorsarray<object>
codeobject
fieldobject
messageobject
warningsarray<object>
codeobject
messageobject
targetobject

Need more? See the Shopify Storefront guide for connection setup and behaviour shared by every action.