Element Events
The main way Method Elements communicates with your application is through HTTP redirects. Your application should intercept the redirects in order to react accordingly to state changes. Your app should listen to both general
events and element specific events.
âšī¸ HTTP redirects from Method Elements are in the following format:
methodelements://{event_source}?{event_data}
General Element Eventsâ
Openâ
The open event is triggered when an element has successfully launched. No data is passed at this time.
methodelements://general
?op=open
&element_type=link
Attributesâ
Name | Type | Description |
---|---|---|
op | string | The operation type returned by the element. |
element_type | string | The element type that returned this event. When the element is not known the type will be unknown |
Errorâ
The error event is sent for any element that encounters any error while it's active.
methodelements://general
?op=error
&element_type=unknown
&type=INVALID_REQUEST
&sub_type=EXPIRED_TOKEN
&message=The public element token is no longer valid. Element tokens are short lived and can only be used once. Request a new element token and try your request again.
&code=400
Attributesâ
Name | Type | Description |
---|---|---|
op | string | The operation type returned by the element. |
element_type | string | The element type that returned this event. When the element is not known the type will be unknown |
code | integer , nullable | The status code of the request. |
type | string | A broad description of the error. |
sub_type | string | The specific error type. |
message | string | A human-readable message providing more details about the error. |
Exitâ
The exit event is the last event in the element flow, at this point your app should no longer present the Method Element. Exit is triggered after an error, a user requested exit or a successful element event.
methodelements://general
?op=exit
&element_type=link
Attributesâ
Name | Type | Description |
---|---|---|
op | string | The operation type returned by the element. |
element_type | string | The element type that returned this event. When the element is not known the type will be unknown |
Link Specific Element Eventsâ
Successâ
The success event is sent when the user has successfully linked their account to Method. This will return an array of accounts
linked to be exchanged later.
methodelements://link
?op=success
&element_type=link
&accounts=%5B%7B%22public_account_token%22%3A%22
pk_acc_iZKeBTmnmw3aSGePcfdweUEJTBXwsfR4%22%2C%22
mask%22%3A%224127%22%7D%5D
when parsed, will would result in the following JSON
{
"accounts": [
{
"public_account_token": "pk_acc_iZKeBTmnmw3aSGePcfdweUEJTBXwsfR4",
"mask": "4127"
}
]
}
Attributesâ
Name | Type | Description |
---|---|---|
op | string | The operation type returned by the element. |
element_type | string | The element type that returned this event. When the element is not known the type will be unknown |
accounts | string | A URL-encoded JSON array with the list of connected public account tokens and their respective mask. |
accounts[n].public_account_token | string | One of the public account tokens returned by the Link Element after successfully connecting. |
accounts[n].mask | string | The last 4 digits of the account number of the connected account. |
Auth Specific Element Eventsâ
Successâ
The success event is sent when the user has successfully verified their identity. This will return a connection ID which will be used to retrieve the created connection.
methodelements://auth
?op=success
&element_type=auth
&authenticated=true
when parsed, will would result in the following JSON
{
"authenticated": true
}
Attributesâ
Name | Type | Description |
---|---|---|
op | string | The operation type returned by the element. |
element_type | string | The element type that returned this event. When the element is not known the type will be unknown |
cxn_id | string | The ID of the connection created. |