View Source Gringotts.Response (gringotts v1.1.1)
Defines the Response struct
and some utilities.
All Gringotts
public API calls will return a Response.t
wrapped in an
:ok
or :error
tuple
. It is guaranteed that an :ok
will be returned
only when the request succeeds at the gateway, ie, no error occurs.
Link to this section Summary
Link to this section Types
@type t() :: %Gringotts.Response{ avs_result: %{street: String.t(), zip_code: String.t()}, cvc_result: String.t(), fraud_review: term(), gateway_code: String.t(), id: String.t(), message: String.t(), raw: String.t(), reason: String.t(), status_code: non_neg_integer(), success: boolean(), token: String.t() }
The standard Response from Gringotts
.
Field | Type | Description |
---|---|---|
success | boolean | Indicates the status of the transaction. |
id | String.t | Gateway supplied identifier of the transaction. |
token | String.t | Gateway supplied token . This is different from Response.id . |
status_code | non_neg_integer | HTTP response code. |
gateway_code | String.t | Gateway's response code "as-is". |
message | String.t | String describing the response status. |
avs_result | map | Address Verification Result. Schema: %{street: String.t, zip_code: String.t} |
cvc_result | String.t | Result of the CVC validation. |
reason | String.t | Explain the reason of error, in case of error. nil otherwise. |
raw | String.t | Raw response from the gateway. |
fraud_review | term | Gateway's risk assessment of the transaction. |
notes
Notes
It is not guaranteed that all fields will be populated for all calls, and some gateways might insert non-standard fields. Please refer the Gateways' docs for that information.
success
is deprecated inv1.1.0
and will be removed inv1.2.0
.For some actions the Gateway returns an additional token, say as reponse to a customer tokenization/registration. In such cases the
id
is not useable because it refers to the transaction, thetoken
is.
On the other hand for authorizations or captures, there's no
token
.
- The schema of
fraud_review
is Gateway specific.