Batch Calls

Warning

The /batch endpoint is deprecated. This page is available for Partners using the legacy endpoint as a reference.

Batch calls allow API applications to make multiple API calls within a single API call. In addition, each call can be tied to a different access_token meaning batch API calls work with multiple users.

Batch calls allow your platform to accomplish more API interaction with less traffic, thus avoiding throttle limits.

Tip

Keep in mind that any call to the WePay API will timeout after 60 seconds. WePay platforms vary in terms of traffic, time out rates, and call duration. As such, WePay recommends that you monitor your platform’s traffic in order to determine the best limit of API calls per batch for your application.


Create a batch object

To create a batch object, make the /batch/create call.

Arguments:

 

Parameter Required Type Description
client_id Yes Integer (64 bits) The ID for your API application. You can find it on your application's dashboard.
client_secret Yes String (255 chars) The secret for your API application. You can find it on your application's dashboard.
calls Yes Array of API calls An array of the API calls that you would like to make (see API call arguments below).

 

Within each index of the calls parameter, each API call has its own separate structure as follows:

Tip

You must pass access_token for each call. For each individual API call, you must pass the access_token of the user you are making the call on behalf of. If you do not, then you will you get an access_denied error with error code 1002.

API call arguments:

 

Parameter Required Type Description
call Yes String (255 chars) The name of the API call you want to make (ie. /checkout/find).
authorization Yes if the API call requires authorization String (255 chars) The access token of the user that is making the API call.
reference_id No String (255 chars) A unique id that you can attach to an API call so that you can specifically identify that call.
parameters Only if the API call requires parameters Array The parameters required by the API call that you specified in the "call" parameter.

 

  • PHP
  • cURL
  • Ruby
  • Python

Response

 

Response Type Description
calls array An array of responses to all the API calls made in the batch call.

 


Complete the Batch Call

You now have the responses to all the batch calls you made in the calls response object. Now, you can make multiple API calls at once, enjoy!