Skip to main content

Working with webhooks and tokenization

Since the tokenization workflows are asynchronous we recommend that you subscribe to at least these webhooks:

Track successes​

By subscribing to the walley:order:created you can receive the OrderId of the order created from the success of this authorization. You will need this OrderId if you want to utilize the Order Management api.

Track failures​

By subscribing to walley:authorization:retrying and walley:authorization:failed webhooks you can follow all the reasons why we are at the moment not able to a fulfill the authorization.

The Reason property in the webhook payload will give you a hint on what went wrong. The possible reasons are:

For the retrying webhook:

ReasonDescription
SERVICE_UNAVAILABLEThere was a temporary issue with the payment provider, and we will retry the authorization.
PAYMENT_METHOD_NO_FUNDSThe payment method used for the authorization has insufficient funds, and we will retry the authorization.
PAYMENT_METHOD_DECLINEDThe payment method used for the authorization was declined by the payment provider or bank, and we will retry the authorization.

For the failed webhook:

ReasonDescription
PAYMENT_METHOD_EXPIREDThe payment method used for the authorization has expired.
PAYMENT_METHOD_REFUSEDThe payment method used for the authorization was refused by the payment provider or bank, for example due to lost or stolen card.
CANCELLED_BY_CUSTOMERThe customer token has been cancelled using the Cancel endpoint.

Testing webhooks​

If you want to test the different outcomes for the webhooks for an authorization, you can simulate an error by modifying the customer token. This is only available in the test environment.

PUT /purchase/customer-tokens/916f7730-8d24-4dd9-9778-92b75b747382 HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json

{
"AuthorizationFailure":
{
"Reason": "Expired"
}
}

Request Properties​

Request headers

HeaderRequiredExplanation
AuthorizationYesInstructions on how to generate the authorization header value can be found here.

Request body

PropertyRequiredExplanation
AuthorizationFailureNoProvide null to remove the error, or an object describing the reason

AuthorizationFailure object

PropertyRequiredExplanation
ReasonNoThe reason can be one of the following: Expired, Refused, ServiceUnavailable, NoFunds, Declined. Set to null to remove the error

Important error responses​

Error codeCause
401Incorrect, missing or expired bearer token
404The customer token was not found for the authenticated bearer token
503There was some internal error. Please try again