Developers

Search the docs

Search guides and headings.

Finish saving a card for a patient

PUT/care/v1/patient/{patient_id}/payment-method/setup/{setup_id}/confirm/document
Scope: patient:writeBAA required

Call it after Stripe.js confirmed the card on your page. It checks the setup, makes sure the card is recorded on the patient's Nurish'd account, and answers the card. When the patient had no default card, the card becomes their default card, the one visits and fees are charged to. A patient who already has a default card keeps it, and the answer says is_default: false.

Calling it again for the same setup is safe, and it does not wait for any notification, so call it right after the card form says it worked. Answers 409 payment_method_setup_incomplete when the card form has not confirmed the card yet, 404 for a setup that is not this patient's, and the same 404, 403 and 409 as the start route for the patient's connection.

Needs the patient:write scope.

Path parameters

  • patient_idstring (uuid)required

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

  • setup_idstringrequired

    The ID of the setup, as the start route answered it.

    Min length 1 · Max length 200 · Pattern ^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$

Response 200

  • 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.

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.
403connection_scope_not_grantedThe connection does not hold the care.bookings scope.
403scope_not_grantedThis API key does not have the patient:write scope.
404not_foundThe requested resource was not found.
409connection_not_activeThe connection is not active.
409payment_method_setup_incompleteThe card has not been confirmed with the card form yet. Confirm it on your page, then call this route again.
422validation_errorpath.patient_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