Developers

Search the docs

Search guides and headings.

List a customer's saved cards

GET/meals/v1/customer/{customer_id}/payment-method/query/documents
Scope: order:read

Returns the cards saved to the customer's Nurish'd account, at most 10, in one page. Each card has id, card (brand, exp_month, exp_year and last4) and is_default, which is true for the customer's default card. The customer can also add, remove and choose cards in their own account, so the list can change without you. A customer with no card gets an empty list.

Answers 404 when the customer has no connection with your company that allows meals, 403 connection_scope_not_granted when the customer did not allow orders, and 409 connection_not_active when the connection is pending or was revoked.

Needs the order:read scope.

Path parameters

  • customer_idstring (uuid)required

    The ID of the customer, as the create-customer route answered it.

Response 200

  • dataarray of PaymentMethodrequired

    The saved cards. At most 10.

    Show child attributesHide child attributes
    • cardPaymentMethodCardrequired

      The card details: brand, expiry month and year, and the last four digits.

      Show child attributesHide child attributes
      • brandstringrequired

        The card brand, for example visa or mastercard.

      • exp_monthintegerrequired

        The month the card expires, 1 to 12.

      • exp_yearintegerrequired

        The four-digit year the card expires.

      • last4stringrequired

        The last four digits of the card.

    • idstringrequired

      The ID of the card.

    • is_defaultbooleanrequired

      Whether this is the person's default card, the one later charges use.

  • has_nextbooleanrequired

    Whether the data has a next page or not

  • has_previousbooleanrequired

    Whether the data has a previous page or not

  • pageintegerrequired

    The page number of the data

  • sizeintegerrequired

    The size of the data

  • totalintegerrequired

    The total number of data

  • total_pagesintegerrequired

    The total number of pages

Errors

Every error has this shape. Branch on code, not on message. request_id equals the X-Request-Id response header.

jsonError response
{
  "error": {
    "code": "not_found",
    "message": "The object does not exist.",
    "request_id": "req_0123456789abcdef0123456789abcdef"
  }
}
StatusCodeMeaning
401invalid_api_keyThe API key is missing or not valid.
403company_archivedThis company is archived.
403company_not_liveThe company must be live to use prod keys.
403company_suspendedThis company is suspended.
403scope_not_grantedThis API key does not have the order:read scope.
404not_foundThe requested resource was not found.
409connection_not_activeThe connection is not active.
422validation_errorpath.customer_id: Input should be a valid UUID, invalid character: found n at 0
429rate_limitedToo many requests. Wait before calling again.
500internal_errorSomething went wrong on our side. Please try again later.
502upstream_errorA Nurish'd service could not complete the request.
503upstream_unavailableA Nurish'd service is unavailable. Please try again later.
504upstream_timeoutA Nurish'd service did not answer in time. Please try again.

All error codes and what to do about them