Skip to main content

Authorization

Whenever you want to charge the customer using a customer token you need to create an authorization which can be auto captured, or captured at a later stage.

Creating an authorization​

The customer token created previously can be used to charge the customer at any time. The customer is charged by creating an authorization using the customer token.

POST /purchase/authorizations HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json

{
"customerToken": "f590b7c4-0d2e-4d99-a3c7-5c1a39f45dce",
"storeId": "1234",
"order": {
"items":[
{
"id": "id-001",
"description": "Description 002",
"unitPrice": "10",
"quantity": "1",
"vat": "25"
},
{
"id": "id-002",
"description": "Description 002",
"unitPrice": "2",
"quantity": "10",
"vat": "12"
}
],
"currency": "EUR",
"reference": "01478520",
"actionReference": "reference 1234",
"captureMode": "Auto"
},
"attemptSchedule": {} // Optional, see below
}

attemptSchedule (optional)

Defines when attempts should be made. Only one of the following fields may be set:

  • relative: List of time offsets relative to the previous attempt
  • absolute: List of absolute timestamps
  • preferSynchronous: A single attempt will be performed synchronously if no challenge is needed.
  • If omitted, a single asynchronous attempt will be made as soon as possible.
    "attemptSchedule": {
"relative": ["00:00:10", "00:00:10", "00:00:10", "00:00:10", "1.00:00:10"],
}
    "attemptSchedule": {
"absolute": ["2023-12-24T14:00:00", "2023-12-11T18:30:00"],
}
    "attemptSchedule": {
"preferSynchronous": true
}

Request Properties​

Request headers

HeaderRequiredExplanation
AuthorizationYesInstructions on how to generate the authorization header value can be found here.
Walley-Idempotency-KeyNoInstructions on how to use idempotency can be found here.
PropertyRequiredExplanation
customerTokenYesThe customer token retrieved from the initial Walley Checkout information
storeIdNoIf not provided then the store id in the customer token is used
orderYesOrder related information, see Order tab
attemptScheduleNoIf not provided, we will perform one asynchronous attempt as soon as possible

Important status codes​

Http status codeCause
200Authorization completed synchronously
202Authorization created - asynchronous workflow initiated
400Could be missing required properties, invalid schedule, or other client side verifiable errors
401Incorrect, missing or expired bearer token
404The customer token was not found for the authenticated bearer token
422The authorization could not be performed, see authorization error codes below
503There was some internal error. Please try again

Authorization error codes​

No matter if you are doing a synchronous or asynchronous authorization, some errors might occur.

  • If you are doing a synchronous authorization then you will get an http response containing the error reason.
  • If you are doing an asynchronous authorization then you might get an http response containing the error reason, or if the error occurs asynchronously then you will recieve a webhook.
Error reasonCauseMeaningful to retry
INVALID_CURRENCYThe provided currency does not match the currency associated with the customer token.No
TOKEN_PENDINGThe customer token is pending review. An authorized signatory must approve or deny the buyer in MyWalley Business.No
TOKEN_DENIEDThe customer token has been denied. The buyer was denied in MyWalley Business.No
TOKEN_REVOKEDThe customer token has been revoked. The buyer was revoked in MyWalley Business.No
TOKEN_CANCELLEDThe customer token has been cancelled using the cancellation endpoint.No
PAYMENT_METHOD_NO_FUNDSThe debit payment method associated with the token does not have enough funds on it.No
PAYMENT_METHOD_EXPIREDThe payment method associated with the token have expired.No
PAYMENT_DENIEDUser was denied to purchase. This could be for many non-technical reasons.No
PAYMENT_FAILEDPayment failed due to technical or configuration issues.Yes
SERVICE_UNAVAILABLEAn unexpected problem occurred making the service temporarily unavailable. Please Contact Walley support for further information.Yes
IDEMPOTENCY_REQUEST_IN_PROGRESSAnother request with the same idempotency key is in progress.Yes
IDEMPOTENCY_RESPONSE_EXPIREDResponses are cached for one hour. If you get this message then you should make your retry sooner.No
IDEMPOTENCY_MISMATCHING_REQUEST_TYPEThe same idempotency key has been used for a different request type.No