# `MishkaPay.Errors.Rejected`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/lib/mishka_pay/__errors/rejected.ex#L5)

The provider answered with an error that is not a decline: bad keys, a request it did not accept,
a missing payment, a failure on its side after every retry.

  * `:provider`: the provider's id.
  * `:status`: the HTTP status it answered.
  * `:code`: its own short code, such as `"resource_missing"`, when it gave one;
    `"idempotency_error"` when a reference was reused with other details, `"already_exists"`
    when a code or id is taken.
  * `:param`: the field it refused, when it named one: under Mishka Pay's own name when it has
    one (`"trial_days"`, `"quantity_min"`), as the provider said it otherwise.
    `code: "managed_payments_invoice"` is an invoice turned off where the provider, as merchant of
    record, must make one; `"tax_code_missing"` a product it sells as merchant of record without
    a tax category; `"merchant_of_record_off"` a choice (`:param`) the provider takes only with
    merchant of record off; `"one_time_only"` and `"recurring_only"` a choice (`:param`) that
    goes only with one-time prices, or only with a plan's; `"capture_invoice"` a checkout that
    holds the money (`capture: :manual`) where an invoice is made after payment, as a merchant
    of record always makes one; `"tax_id_invalid"` a tax id whose number
    does not have the form its kind needs; `"tax_not_set_up"` a tax calculation on an account
    whose tax service is off; `"tax_location_invalid"` a buyer's address too thin to count the
    tax; `"managed_payments_shipping"` shipping asked of a checkout the provider sells as
    merchant of record; `"portal_feature_off"` a portal task the portal's settings turn off;
    `"subscription_of_another"` a subscription that belongs to another customer;
    `"intent_of_invoice"` and `"intent_of_checkout"` a PaymentIntent an invoice or a checkout
    made, which only its invoice (voided) or its checkout (expired) can end;
    `"account_invalid"` a connected account (the keys' `:account_id`) the key has no access to,
    or that does not exist; `"connect_not_set_up"` a connected account asked of a platform that
    has not signed up for Connect; `"connect_v1_refused"` an account made with Accounts v1 on a
    platform Stripe allows only Accounts v2; `"connect_needs_sandbox"` an onboarding link Stripe
    makes only in a sandbox, not in an account's test mode; `"failed_tax_calculation"` a sale
    whose tax the provider could not count (its tax service failed, not the address);
    `"dispute_evidence_page_limit_exceeded"` dispute evidence longer than the card network
    takes.
  * `:message`: its own words, for the log. People see `Exception.message/1` instead, which never
    repeats them (they can name keys and ids).
  * `:request_id`: the provider's id of the request that failed (Stripe's `Request-Id` header,
    PayPal's debug id), when it gave one. Quote it to the provider's support, or find the request
    in its dashboard log.
  * `:doc_url`: the provider's page about the error, when it named one.
  * `:rate_limit_reason`: why the provider limited the rate of a request it answered 429 for,
    when it said (Stripe's `Stripe-Rate-Limited-Reason`: `"global-rate"`, `"endpoint-rate"`,
    `"global-concurrency"`, `"endpoint-concurrency"`, `"resource-specific"`). Its message
    then says to try again in a moment.

The request id and the page are for support and the log only: `Exception.message/1` never shows
them.

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %MishkaPay.Errors.Rejected{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  code: term(),
  doc_url: term(),
  message: term(),
  param: term(),
  path: term(),
  provider: term(),
  rate_limit_reason: term(),
  request_id: term(),
  splode: term(),
  stacktrace: term(),
  status: term(),
  vars: term()
}
```

Create an `Elixir.MishkaPay.Errors.Rejected` without raising it.

## Keys

- :provider
- :status
- :code
- :param
- :message
- :request_id
- :doc_url
- :rate_limit_reason

---

*Consult [api-reference.md](api-reference.md) for complete listing*
